• 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

JMS: ClassCastException with Queue

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I have a small program that tries to send JMS messages to a JBoss 3.2.1 server that currently runs on the same machine. I get a ClassCastException at this line of code:

Queue q = (Queue)context.lookup("myQueue");
I use this code for getting the context:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost:1099");
env.put("java.naming.rmi.security.manager", "yes");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");
Context cntxt = new InitialContext(env);
When I print the q object, it shows:
Reference Class Name: org.jboss.mq.SpyQueue
Type: name
Content: myQueue
In Jboss documentation they say SpyQueue implements the javax.jms.Queue. So how can it not be casted to it?
I don't know what I did today - the code still worked yesterday! Back then, the type of the queue was SpyQueue only in one case and otherwise the type was 'QUEUE.myQueue' - which worked fine. Does anybody know what this QUEUE-type is and how could I get the queue changed to it again?
Regards,
Susanna
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the JBoss Forum...
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic