This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error using JNDI in JMS Queue lookup

 
s ravi chandran
Ranch Hand
Posts: 469
Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are using two different vendor connection factories.
 
s ravi chandran
Ranch Hand
Posts: 469
Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 469
Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Humans and their filthy friendship brings nothing but trouble. My only solace is this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!