Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Error using JNDI in JMS Queue lookup

 
Ranch Hand
Posts: 595
6
jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are using two different vendor connection factories.
 
s ravi chandran
Ranch Hand
Posts: 595
6
jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 595
6
jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic