The moose likes EJB and Other Java EE Technologies and the fly likes Error using JNDI in JMS Queue lookup Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » EJB and Other Java EE Technologies
Reply Bookmark "Error using JNDI in JMS Queue lookup" Watch "Error using JNDI in JMS Queue lookup" New topic
Author

Error using JNDI in JMS Queue lookup

s ravi chandran
Ranch Hand

Joined: Dec 20, 2010
Posts: 68
Hi,

I have using OpenMQ 4.5 to run a simple JMS example. I am following the example given at OpenMQ Blog. Now the procedure for lookup of connection factory and queue name is same. I have applied the same process to the HelloProducer. But when I run the producer, I get this error:

Exception in thread "main" java.lang.ClassCastException: com.sun.messaging.ConnectionFactory cannot be cast to javax.jms.QueueConnectionFactory
at messaging2.HelloProducer2.<init>(HelloProducer2.java:59)
at messaging2.HelloProducer2.main(HelloProducer2.java:130)

Can anyone tell me what can be the possible cause? I tried running another JMS example from an ebook, even in that I had the same issue, so I think I am missing some important logic here.

Thanks
Andrew Moko
Ranch Hand

Joined: Dec 16, 2011
Posts: 55
You are using two different vendor connection factories.
s ravi chandran
Ranch Hand

Joined: Dec 20, 2010
Posts: 68
Andrew Gabriel wrote:You are using two different vendor connection factories.


Thanks for replying. I found the offending line, but even after fixing that, it did not work. So, I am trying out a more simpler example. Even that is not working out. This is the code :



I ran this code to set the JNDI name :



But when I run this code, I get this error :



What am I missing?

Thanks
Andrew Moko
Ranch Hand

Joined: Dec 16, 2011
Posts: 55
Pal you are having problems binding your connection factory (MyconnectionFactory). Im not a OpenMQ expert but, verify if you are doing it correctly
s ravi chandran
Ranch Hand

Joined: Dec 20, 2010
Posts: 68
Andrew Gabriel wrote:Pal you are having problems binding your connection factory (MyconnectionFactory). Im not a OpenMQ expert but, verify if you are doing it correctly

Thanks for replying. I had an idea that it had something to do with the JNDI binding, but I was unable to find out the cause. I have figured it out now.. The cause was imqobjmgr parameter "-t ". I was passing wrong administered object type..

I solved it using this command :



Cheers!
 
IntelliJ Java IDE
 
subject: Error using JNDI in JMS Queue lookup
 
Threads others viewed
Spring and JMS integration
JMS - JNDI API lookup failed
@Resource question
JMS and Websphere - Urgent Help
ANN: Habari OpenMQ Client 1.7 - ready for new GlassFish v3.1 application server
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com