-
1. Re: NameNotBound for injected Queue
elkner Nov 3, 2005 5:46 AM (in response to mugwump)Looks like you are using different names for queue setup and lookup ...
-
2. Re: NameNotBound for injected Queue
mugwump Nov 3, 2005 5:58 AM (in response to mugwump)oops,
no: I just changed the name of the queue to protect the innocent, was just a typo - here is the complete setup:
Queue:<?xml version="1.0" encoding="UTF-8"?> <server> <mbean code="org.jboss.mq.server.jmx.Queue" name="jboss.mq.destination:service=Queue,name=myQueue"> <attribute name="JNDIName">myQueue</attribute> <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends> </mbean> </server>
Resource:@Resource (name="myQueue") Queue queue;
Lookup using injected sessionContext:@Resource SessionContext ctx; ... queue = (Queue) ctx.lookup("myQueue");
Still, the queue gives a NameNotBound-Exception, but the lookup using the sesionContext works. -
3. Re: NameNotBound for injected Queue
elkner Nov 3, 2005 7:05 AM (in response to mugwump)Hmmm, what does your server log say, when you try to deploy?
Usually there should be something like:2005-11-02 10:55:16,749 INFO [main:org.jboss.mq.server.jmx.DestinationMBeanSupport:204] - Bound to JNDI name: myQueue
E.g. I'm using<?xml version="1.0" encoding="UTF-8"?> <!-- $Id$ --> <server> <mbean code="org.jboss.mq.server.jmx.Topic" name="jboss.mq.destination:service=Topic,name=foo"> <attribute name="JNDIName">topic/foo/model</attribute> <depends optional-attribute-name="DestinationManager" >jboss.mq:service=DestinationManager</depends> </mbean> </server>
And than you should see Bound to JNDI name: topic/foo/model
BTW: Just to be sure: your queue config file ends with "-service.xml" ? -
4. Re: NameNotBound for injected Queue
mugwump Nov 3, 2005 9:25 AM (in response to mugwump)Thats exactly the problem: The Server-Log confirms, that the queue is deployed correctly, and we can send messages into the queue from both outside the container and from the bean itself, when we look it up manually - only the injection does not work, heaven knows why... Any other injections work flawless, eg. SessionContext via @Resource and even other EJBs via @EJB, both by jndi-name and by type. It's only the queue, that refuses to be injected...
-
5. Re: NameNotBound for injected Queue
dornus Nov 3, 2005 10:19 AM (in response to mugwump)It never worked for me either. I just ended up doing this
@Resource(name = "ConnectionFactory") QueueConnectionFactory factory; //@Resource (name="queue/myQueue")//todo doesn't work..must do manually below //Queue queue; public void someMethod(){ QueueConnection cnn = null; QueueSession sess = null; QueueSender sender = null; try { final InitialContext ctx = new InitialContext(); final Queue queue = (Queue) ctx.lookup("queue/myQueue"); //final QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory"); cnn = factory.createQueueConnection(); sess = cnn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE); ... }
-
6. Re: NameNotBound for injected Queue
dornus Nov 4, 2005 11:38 AM (in response to mugwump)I think you may find another correct answer from this thread
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=71996