Getting NoClassDefFoundError when trying to create OmmConsumer object

Hi,

I am trying to create the OmmConsumer object by providing the EmaConfig parameters, username and Consumer Name.


OmmConsumerConfig config = EmaFactory.createOmmConsumerConfig(configPath);
consumer = EmaFactory.createOmmConsumer(config.consumerName(consumerName).username(userName));

I am getting the below Exception and connection is not getting established.

Exception in thread "pool-15-thread-1" java.lang.NoClassDefFoundError: Could not initialize class com.refinitiv.eta.transport.WebSocketRequestHeader

at com.refinitiv.eta.transport.WebSocketHandlerImpl.createRequestHandshake(WebSocketHandlerImpl.java:143)

at com.refinitiv.eta.transport.RsslSocketChannel.initChnlSendWebSocketHandshakeRequest(RsslSocketChannel.java:3533)

at com.refinitiv.eta.transport.RsslSocketChannel.init(RsslSocketChannel.java:3430)

at com.refinitiv.eta.valueadd.reactor.Worker.initializeChannel(Worker.java:575)

at com.refinitiv.eta.valueadd.reactor.Worker.run(Worker.java:99)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:750)


I am using EMA and ETA version 3.7.3.0 library and all the libraries are part of the class path.

export CLASSPATH="<path>/ema-3.7.3.0.jar:$CLASSPATH"

export CLASSPATH="<path>/eta-3.7.3.0.jar:$CLASSPATH"

export CLASSPATH="<path>/etaValueAdd-3.7.3.0.jar:$CLASSPATH"

export CLASSPATH="<path>/etaValueAddCache-3.7.3.0.jar:$CLASSPATH"

export CLASSPATH="<path>/ansipage-3.7.3.0.jar:$CLASSPATH"

export CLASSPATH="<path>/etajConverter-3.7.3.0.jar:$CLASSPATH"

export CLASSPATH="<path>/commons-configuration2-2.9.0.jar:$CLASSPATH"

export CLASSPATH="<path>/commons-lang3-3.13.0.jar:$CLASSPATH"

export CLASSPATH="<path>/commons-text-1.11.0.jar:$CLASSPATH"

export CLASSPATH="<path>/httpcore-nio-4.4.16.jar:$CLASSPATH"

export CLASSPATH="<path>/jose4j-0.9.3.jar:$CLASSPATH"

export CLASSPATH="<path>/lz4-java-1.8.0.jar:$CLASSPATH"

export CLASSPATH="<path>/xpp3-1.1.4c.jar:$CLASSPATH"

Below the channel configuration defined in EmaConfig.xml

<Channel>

<Name value="Channel_3"/>

<ChannelType value="ChannelType::RSSL_ENCRYPTED"/>

<EncryptedProtocolType value="EncryptedProtocolType::RSSL_WEBSOCKET"/>

<GuaranteedOutputBuffers value="5000"/>

<Host value="host"/>

<Port value="port"/>

<WsMaxMsgSize value="61440"/>

<WsProtocols value="tr_json2"/>

</Channel>

Did anyone faced similar issue and able to resolve it?

Best Answer

  • Gurpreet
    Answer ✓

    Hi @sarthak.banerjee,

    I haven't investigated in detail, but it looks like you have not included all the jar files required for resolution. Please include all the jars in the classpath from the following location in the SDK package:

    Ema\Libs
    Eta\Libs
    RTSDK-BinaryPack\Java\Ema\Libs
    RTSDK-BinaryPack\Java\Eta\Libs

    Alternatively, you can use the provided Gradle build, since it will automatically resolve all the dependencies for your project.