[jboss-user] [Clustering/JBoss] - ConnectionFactory && HA-JNDI
trunikov
do-not-reply at jboss.com
Wed Dec 19 05:02:50 EST 2007
Hi ALL!
Environment:
AS: jboss-4.2.2.GA
Command line: run.bat -c all -b 0.0.0.0 -g XXX
Problem:
My application has servlet which has init code to obtain queue and JMS connection factory. The code can obtain a reference to queue but it fails to get reference on a connection factory:
11:20:00,925 ERROR [[/phs]] Servlet /xxx threw load() exception
| javax.naming.NameNotFoundException: jms/ConnectionFactory
| at org.jboss.ha.jndi.TreeHead.lookup(TreeHead.java:242)
| at org.jboss.ha.jndi.HAJNDI.lookup(HAJNDI.java:155)
| ...
|
The init code is:
Properties p = new Properties();
| p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
| p.put(Context.PROVIDER_URL, "localhost:1100"); // HA-JNDI port.
| InitialContext ctx = new InitialContext(p);
| queue = (Queue) ctx.lookup("queue/xxxQueue");
| QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup("jms/ConnectionFactory" /*"jnp://localhost:1100/ConnectionFactory"*/);
|
The error occures on the last line in the code above. I can avoid the error by using commented out JNDI name. But I think that JNDI name "jms/ConnectionFactory" should be valid too because I have mappings in web.xml and jboss-web.xml descriptors. In any case it is not clear why the first lookup passed and the second one fails. Please point me what I missed. Thanks in advance for any reply.
web.xml:
<resource-ref>
| <description>Default QueueFactory</description>
| <res-ref-name>jms/ConnectionFactory</res-ref-name>
| <res-type>javax.jms.QueueConnectionFactory</res-type>
| <res-auth>Container</res-auth>
| </resource-ref>
|
| <resource-ref>
| <description>Queue</description>
| <res-ref-name>queue/xxxQueue</res-ref-name>
| <res-type>javax.jms.Queue</res-type>
| <res-auth>Container</res-auth>
| </resource-ref>
|
jboss-web.xml:
| <resource-ref>
| <res-ref-name>jms/ConnectionFactory</res-ref-name>
| <jndi-name>jnp://localhost:1100/ConnectionFactory</jndi-name>
| <res-type>javax.jms.QueueConnectionFactory</res-type>
| </resource-ref>
|
| <resource-ref>
| <res-ref-name>queue/phsMessagesGatewayQueue</res-ref-name>
| <jndi-name>jnp://localhost:1100/queue/xxxQueue</jndi-name>
| <res-type>javax.jms.Queue</res-type>
| </resource-ref>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4114127#4114127
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4114127
More information about the jboss-user
mailing list