[jboss-user] [JBoss Messaging] - Tomcat and JBoss messaging
jaya_srini
do-not-reply at jboss.com
Wed Feb 13 14:42:49 EST 2008
Hi
I have a tomcat app that needs to send and receive JMS messages from JBoss App server (4.2.2) with JBOSS messaging. Both the tomcat service and the JBoss App Server are on the same machine.
I made the following changes on the Tomcat side
1) Added the following to {catalina-home}/conf/context.xml
<Resource
name="/ConnectionFactory"
auth="Container" type="org.jboss.jms.server.connectionfactory.ConnectionFactory" factory="org.jboss.jms.server.bridge.JNDIConnectionFactoryFactory" description="JBOSS JMS Connection Factory for sending recieving messages"
/Resource>
2) Added the following to web-inf/web.xml
<resource-env-ref>
<resource-env-ref-name>/ConnectionFactory</resource-env-ref-name>
<resource-env-ref-type>org.jboss.jms.server.connectionfactory.ConnectionFactory</resource-env-ref-type>
</resource-env-ref>
3) In my java code I do the following
mLog.info("creeating InitialContext");
Properties jndiProps = new Properties();
jndiProps.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
jndiProps.setProperty(Context.URL_PKG_PREFIXES,
"org.jboss.naming:org.jnp.interface");
jndiProps.setProperty(Context.PROVIDER_URL, "jnp://10.195.4.123:1099");
ic = new InitialContext(jndiProps);
mLog.info("Looking up environment context");
Context envCtx = (Context) ic.lookup("java:comp/env");
mLog.info("Looking up Connection factory");
ConnectionFactory cf = (ConnectionFactory)envCtx.lookup("/ConnectionFactory");
When I run the above on Tomcat I get the following error
javax.naming.NameNotFoundException: comp not bound
I verified JBOSS app server was running on port 1099. Can someone help?
thanks!
Jaya
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4129243#4129243
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4129243
More information about the jboss-user
mailing list