• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

classcast exception while using JMS with Jboss

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i m using JBoss 4.0.3 and i am getting a class cast exception when i try to look up any thing in the context...
e.g. when i say:
myQueue = (Queue) ctx.lookup("queue/A")
i get a class cast exception.

I have included jms.jar in the classpath.

Any help will be appreciated..

Thanx in advance.
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd check to see if the Queue is bound to that JNDI value or something else (like an MBean representing the queue, or the QueueConnectionFactory). Easy way to find out is to just get the Object from the context, and log the class name.
[ January 31, 2006: Message edited by: Reid M. Pinchback ]
 
Akash Abrol
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
queue is properly bound to the name "queue/A"...
and the class return by
ctx.lookup("queue/A") is org.jboss.mq.SpyQueue which directly implements javax.jms.Queue...

Can u help me now.....
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm... if you are sure SpyQueue implements Queue, then clearly you shouldn't be getting a ClassCastException. Either you are incorrect about SpyQueue, or your exception is coming from somewhere else. I'd be sure to do a clean recompile with debug info in your classes, and re-examine your stack trace.

Another thought comes to mind. Are you running this code in a client external to the JBoss server, or something internal (e.g. a webapp?). If the former (i.e. external), don't forget to narrow the object returned by JNDI.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup(dsJndiName);
 
Wiley Snyder
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try "java:/< your jndi name> " ...

as your jndi name when you connect ...

ie...

(java:/MyJindiName)
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Friends
I want to know that if i am sending message through JMS and JBoss Application server.After getting the message,Application server will send Acknowledgement to the Client.If connection break in between receiving the
Acknowledgement then how can it recover.

Please send me response as soon as possible.
If possible then give Some code.
Thanks
Rakesh
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Akash Abrol,

Were you able to solve you issue of Classacst exeption? I am having the problem. Coul dyou elase throw some light on this ?

-Sudheer.
 
Sudheer Ch
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok. I fixed my issue.

I have both jboss-j2ee.jar and jbossall-client.jar in my classspath. Both have javax.jms.Queue in them and could be of different versions. jbossall-client.jar has both org.jboss.mq.SpyQueue and javax.jms.Queue.

I removed jboss-j2ee.jar from my classspath to resolve my issue.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic