Tomcat+OpenJms: Naming Exception

"Laurent BONANSEA" <[email protected]> Sun, 30 Apr 2006 02:04:03 +0000
Newsgroups gmane.comp.java.openjms.user
Message-ID <[email protected]>
Hi everyone,

Could you help me to identify the cause of a JNDI naming convention pbm. Sorry, perhaps I made a usual mistake, but I am somewhat a week-end worker only. Where can I find a step/step explaination about openjms+tomcat but with config files (that miss frequently).

For the approach, I presume that the connection once made from tomcat by the factory is set with tcp://localhost:3035/, queues, topics etc. are check by tcp://localhost:3035/ in openjms.xml.

Many thanks!

Environment: Win XP, Tomcat 5.0.28 (works fine), Axis 1.1 (works fine), openjms-0.7.7-alpha-3 (works fine with provided samples and as a standalone server - nothing included in tomcat)

Objective: from an axis web service (that works), send a received message to an openjms queue

Issue: a NamingException when accessing the JNDI connection factory (see output below)

...

INFO: Server startup in 9672 ms

MyTRACE: 03:10

MyTRACE: 1a

MyTRACE: 1b - create context (but certainly not initialised)...

javax.naming.NamingException: Cannot create resource instance

at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:132)

at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)

at org.apache.naming.NamingContext.lookup(NamingContext.java:791)

…

at java.lang.Thread.run(Thread.java:536)

Java code:

Context context = null;

ConnectionFactory factory = null;

Connection connection = null;

String factoryName = "java:comp/env/jms/MyConnectionFactory";

…

destName = "queue3";

try {

// create the JNDI initial context.

System.out.println("MyTRACE: 03:10");

System.out.println("MyTRACE: 1a");

context = new InitialContext();

String target = "";

// List the objects

NamingEnumeration enum = context.list(target);

while (enum.hasMore()) {

System.out.println(enum.next());

}

System.out.println("MyTRACE: 1b - create context (but certainly not initialised)...");

// look up the ConnectionFactory [au départ, lit dans openjms.xml - doit lire dans axis.xml]

factory = (ConnectionFactory) context.lookup(factoryName); // EXCEPTION HERE!!

System.out.println("Factory: " + factory.getClass().getName());

System.out.println("1c - does not appear in the trace/output");

…

Config: 1) openjms.xml: the one by default; 2) axis.xml (see below)

<Context displayName="Apache-Axis" docBase="axis" path="/axis" workDir="work\Catalina\localhost\axis">

<Resource auth="Container" name="jms/MyConnectionFactory" type="javax.jms.ConnectionFactory"/>

<ResourceParams name="jms/MyConnectionFactory">

<parameter>

<name>java.naming.factory.initial</name>

<value>org.exolab.jms.jndi.InitialContextFactory</value>

</parameter>

<parameter>

<name>java.naming.provider.url</name>

<value>tcp://localhost:3035/</value>

</parameter>

<parameter>

<name>java.naming.security.principal</name>

<value>admin</value>

</parameter>

<parameter>

<name>java.naming.security.credentials</name>

<value>openjms</value>

</parameter>

</ResourceParams>

</Context>

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642