-
1. Re: ClassCastException on Queue JNDI lookup
genman Aug 27, 2005 2:31 AM (in response to zhensley2)jdni.properties -> jndi.properties ? You can turn on debug and see if you're actually talking to JBoss.
-
2. Re: ClassCastException on Queue JNDI lookup
anand.g.verma Sep 6, 2005 3:34 AM (in response to zhensley2)Hi
I am also facing the same problem.
I am using samples given in the JBoss distribution as per the JBossMQWiki.
However when I use testQueue then I get ClassCastException and if I use queue A then I get Queue not bound exception.
==============================================
Here is my code:
Properties properties = new Properties();
properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.provider.url","jnp://localhost:1099");
properties.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
InitialContext ctx = new InitialContext(properties);
log.info("Looking up queueA");
Queue queue = (Queue) ctx.lookup("Queue/A");
=============================================
My jbossmq-destinations-service.xml
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager
<depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager
-1
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager
===============================================
Please let me know if this is incorrect and if yes then what needs to be done. -
3. Re: ClassCastException on Queue JNDI lookup
darranl Sep 6, 2005 6:00 AM (in response to zhensley2)If you are getting a ClassCastException post the Exception stack trace and message.
-
4. Re: ClassCastException on Queue JNDI lookup
anand.g.verma Sep 6, 2005 7:31 AM (in response to zhensley2)Exception in thread "main" java.lang.ClassCastException: javax.naming.Reference
at QClient.main(QClient.java:33) -
5. Re: ClassCastException on Queue JNDI lookup
anand.g.verma Sep 6, 2005 9:01 AM (in response to zhensley2)I found the reason for this. It has nothing to do with ClassCastException actually.
The JMS client was not able to connect to JBoss server hence I was not getting the Queue type object and thus the ClassCastException.
Putting jbossall-client.jar in the classpath solved the problem. -
6. Re: ClassCastException on Queue JNDI lookup
darranl Sep 6, 2005 9:22 AM (in response to zhensley2)Yes the fact the ClassCastException mentions javax.naming.Reference is enough information to realise you had jars missing on your classpath.