Rabbit MQ JMS Client 2.3.0, JMS Queue connection error javax.naming.NoInitialContextException: Cannot instantiate class: com.rabbitmq.jms.admin.RMQObjectFactory [Root exception is java.lang.ClassCastException: com.rabbitmq.jms.admin.RMQObjectFactory

50 views
Skip to first unread message

Surendra K

unread,
Jan 31, 2022, 1:21:52 PMJan 31
to
Hi Experts,

We recently deployed RabbitMQ JMS client 2.3.0 jar and its dependences jar slf4j-api-2.0.0-alpha5.jar
amqp-client-5.14.0.jar
rabbitmq-jms-2.3.0-sources.jar

into our SAP PI/PO system.

After succesfull deployment and communication channel configuration we are unable to reach or connect JMS queue and we are getting following error.

" EXCEPTION]
javax.naming.NoInitialContextException: Cannot instantiate class: com.rabbitmq.jms.admin.RMQObjectFactory [Root exception is java.lang.ClassCastException: com.rabbitmq.jms.admin.RMQObjectFactory (loaded by library:com.sap.aii.adapter.lib.jms20@69499 com.sap.engine.boot.loader.ResourceMultiParentClassLoader) cannot be cast to javax.naming.spi.InitialContextFactory (loaded by <bootstrap>)]"


kindly Suggest.

Thanks in Advance.

Regards,
Surendra

Eric Sosman

unread,
Jan 31, 2022, 3:04:08 PMJan 31
to
The immediate Java problem is that the RMQObjectFactory class does
does not implement the InitialContextFactory interface, so an RMQOF
instance cannot be cast to ICF.

... which is no help at all: It's like saying "The reason this man
can't walk is that he has no legs," and not addressing how he lost his
legs nor why the legless man is trying to walk in the first place.

Although I personally have no experience with RabbitMQ (nor with
anything JNDI, for that matter), it appears to me you should seek
Rabbit advice rather than Java advice. A quick look around the Web
finds several Rabbit-oriented sites; maybe some of them can help you.

--
eso...@comcast-dot-net.invalid
Look on my code, ye Hackers, and guffaw!

Arne Vajhøj

unread,
Jan 31, 2022, 3:18:52 PMJan 31
to
On 1/31/2022 3:03 PM, Eric Sosman wrote:
> On 1/31/2022 1:21 PM, Surendra K wrote:
>> We recently deployed RabbitMQ JMS client 2.3.0 jar and its dependences
>> jar     slf4j-api-2.0.0-alpha5.jar
>>     amqp-client-5.14.0.jar
>>     rabbitmq-jms-2.3.0-sources.jar
>>
>> into our SAP PI/PO system.
>>
>> After succesfull deployment and communication channel configuration we
>> are unable to reach or connect  JMS queue   and we are getting
>> following error.
>>
>> "    EXCEPTION]
>> javax.naming.NoInitialContextException: Cannot instantiate class:
>> com.rabbitmq.jms.admin.RMQObjectFactory [Root exception is
>> java.lang.ClassCastException: com.rabbitmq.jms.admin.RMQObjectFactory
>> (loaded by library:com.sap.aii.adapter.lib.jms20@69499
>> com.sap.engine.boot.loader.ResourceMultiParentClassLoader) cannot be
>> cast to javax.naming.spi.InitialContextFactory (loaded by <bootstrap>)]"
>
>     The immediate Java problem is that the RMQObjectFactory class does
> does not implement the InitialContextFactory interface, so an RMQOF
> instance cannot be cast to ICF.
>
>     ... which is no help at all: It's like saying "The reason this man
> can't walk is that he has no legs," and not addressing how he lost his
> legs nor why the legless man is trying to walk in the first place.

It reveals a little bit.

I seems like the application is attempting to do a JNDI lookup and
it fails early because it get a JMS class instead of a
InitialContextFactory.

So looking at the JNDI configuration could be relevant.

>     Although I personally have no experience with RabbitMQ (nor with
> anything JNDI, for that matter), it appears to me you should seek
> Rabbit advice rather than Java advice.  A quick look around the Web
> finds several Rabbit-oriented sites; maybe some of them can help you.

Some RabbitMQ Java client advice. The RabbitMQ server developers
using Erlang are probably not going to be able to help.

But maybe SAP can help. If it is a SAP system then they
should be first in line to help.

Arne


Andreas Leitgeb

unread,
Feb 1, 2022, 6:52:31 AMFeb 1
to
Surendra K <kvsb...@gmail.com> wrote:
> javax.naming.NoInitialContextException: Cannot instantiate
> class: com.rabbitmq.jms.admin.RMQObjectFactory [Root exception is
> java.lang.ClassCastException: com.rabbitmq.jms.admin.RMQObjectFactory
> (loaded by library:com.sap.aii.adapter.lib.jms20@69499
> com.sap.engine.boot.loader.ResourceMultiParentClassLoader) cannot be
> cast to javax.naming.spi.InitialContextFactory (loaded by <bootstrap>)]"

Looks like you configured "com.rabbitmq.jms.admin.RMQObjectFactory" as
value for some property within the application-context, but that property
should have the name of a different class.

The the correct class's name likely ends with *ContextFactory, rather
than with *ObjectFactory.

You might open the rabbitMQ-jarfile as a zip-file and list its contents.
Maybe some class in it even has a name like "RMQContextFactory".

Andreas Leitgeb

unread,
Feb 1, 2022, 9:25:53 AMFeb 1
to
I googled some more, and found page:
https://docs.parasoft.com/display/SVC20201/JMS+Provider+Configuration
(search for RabbitMQ within that page)

that seems to suggest:
com.sun.jndi.fscontext.RefFSContextFactory
as the initial context factory.

Not sure if "com.sun.*" classes even exist any more... but maybe thats
the starting point for another search, for the replacement.

Natalia Arenas

unread,
Aug 2, 2022, 11:06:02 AMAug 2
to
Buenos dias.

Necesito su apoyo si tienen alguna guia para instalar el driver rabbit MQ en SAP PO por NDWS.

Ricardo Palomares Martinez

unread,
Aug 2, 2022, 2:26:24 PMAug 2
to
El 2/8/22 a las 17:05, Natalia Arenas escribió:
> Buenos dias.
>
> Necesito su apoyo si tienen alguna guia para instalar el driver rabbit MQ en SAP PO por NDWS.

Natalia, este grupo es de comunicación en inglés. Sinceramente, no sé
bien qué es Rabbit MQ, :-) pero he encontrado este artículo en los
blogs de SAP:

https://blogs.sap.com/2017/11/30/hello-world-of-rabbitmq/

-----

Natalia, in this newsgroup English language is expected. Honestly, I
don't really know what is Rabbit MQ, :-) but I've found this article
in SAP blogs:

https://blogs.sap.com/2017/11/30/hello-world-of-rabbitmq/

HTH


Natalia Arenas

unread,
Sep 14, 2022, 8:37:03 AMSep 14
to
muchas gracias.. ya con el equipo basis al parecer logramos hacer la instalación, pero tenemos unos errores,, habrá algun instructivo para la configuracion en sap pi de los canales JMS en relación a rabbit?. mi l
gracias
Reply all
Reply to author
Forward
0 new messages