why dictionary retrieval failed

guchao691
guchao691 Newcomer

When debugging the code at night in China time, the following error was reported. Why?

image

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @guchao691

    I can replicate this issue when using ChannelType::RSSL_ENCRYPTED.

    Exception in thread "main" java.lang.ClassCastException: com.refinitiv.ema.access.EncryptedChannelConfig cannot be cast to com.refinitiv.ema.access.SocketChannelConfig
        at com.refinitiv.ema.access.OmmConsumerImpl.loadDictionary(OmmConsumerImpl.java:385)
        at com.refinitiv.ema.access.OmmConsumerImpl.handleAdminDomains(OmmConsumerImpl.java:450)
        at com.refinitiv.ema.access.OmmBaseImpl.initialize(OmmBaseImpl.java:285)
        at com.refinitiv.ema.access.OmmConsumerImpl.<init>(OmmConsumerImpl.java:43)
        at com.refinitiv.ema.access.EmaFactory.createOmmConsumer(EmaFactory.java:237)
        at com.refinitiv.ema.examples.training.consumer.series100.ex100_MP_Streaming.Consumer.main(Consumer.java:57)

    It looks like to be a problem in the API. According to the class hierarchy, EncryptedChannelConfig can't be cast to SocketChannelConfig.

    image

    You can report this issue via GitHub.

    For the workaround:

    1. You can load the data dictionary from the local files instead.

    <Dictionary>
                <Name value="Dictionary_2"/>
                <DictionaryType value="DictionaryType::FileDictionary"/>

                <!-- dictionary names are optional: defaulted to RDMFieldDictionary and enumtype.def -->
                <RdmFieldDictionaryFileName value="./RDMFieldDictionary"/>
                <EnumTypeDefFileName value="./enumtype.def"/>
            </Dictionary>

    2. Or, you can increase the value of DictionaryRequestTimeOut configuration under the Consumer.

    image

        <ConsumerList>
            <Consumer>
                <!-- Name is mandatory                                                                        -->
                <Name value="Consumer_1"/>
                <DictionaryRequestTimeOut value="0"/>

Answers