• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cant get reference to Queue

 
John R Roberts
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, when the following code executes



i get an exception.
queue = (Queue) ctx.lookup("queue/MyTestQueue");

why is this?
I am using JBoss and have defined the Queue.
 
John R Roberts
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops...
i get an exception.
queue = (Queue) ctx.lookup("queue/MyTestQueue");


the exception is
java.lang.ClassCastException: javax.naming.Reference
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post the exception stacktrace that you are seeing and also how have you defined the queue?
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see you posted that exception stacktrace just when i asked for it From where are you looking up this queue? Is it a standalone java class or is it some servlet/jsp?
 
John R Roberts
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to send the message from a simple standalone java class.
I defined the queue in
jboss-4.0.3SP1\server\default\deploy\jms\jbossmq-destinations-service.xml

as
<mbean code="org.jboss.mq.server.jmx.Queue"
name="jboss.mq.destination:service=Queue,name=MyTestQueue">
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
</mbean>
which is a copy and paste from the examples already there.

anything else you need to know?
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you made sure that the client jars from JBoss, especially the jbossall-client.jar, is present in the standalone client's classpath? You can find the client jar(s) in %JBOSS_HOME%/client folder
[ March 03, 2007: Message edited by: Jaikiran Pai ]
 
John R Roberts
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to be sure I left nothing out I have just added all the jars in that folder to my classpath and still I get the same result
I was hoping it was a classpath issue
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have just added all the jars in that folder to my classpath


Just to be completely sure that they are in the classpath, can you tell me how did you add them to the classpath? Can you post the %classpath% value?
 
John R Roberts
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Eclipse and added them to the classpath. I am running the app using eclipse too.

here is my code also
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strange. I have an exactly similar sample application in Eclipse which is meant to do the same.



However in my classpath i have placed ONLY the following jars:

jboss-client.jar, jboss-common-client.jar, jboss-j2ee.jar, jbossmq-client.jar, jboss-system.jar, jnp-client.jar, log4j.jar, concurrent.jar

Additionally, can you follow these steps to check the JNDI tree in JBoss:

- Go to http://localhost:8080/jmx-console
- Click on service=JNDIView
- On the page that comes up click on the Invoke button beside the list() method
- This will show up the JNDI contents in JBoss.

Post the contents here.
[ March 03, 2007: Message edited by: Jaikiran Pai ]
 
John R Roberts
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just removed everything and readded them and it worked.
how frustrating...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic