RE: Tomcat+OpenJms: Naming Exception
"Tim Anderson" <[email protected]> Wed, 3 May 2006 09:52:52 +1000
| Newsgroups | gmane.comp.java.openjms.user |
|---|---|
| Message-ID | <[email protected]> |
You would only use Axis' JNDI provider if you had configured OpenJMS to use
it rather than its own embedded one.
You need to construct an InitialContext that connects to OpenJMS' JNDI
provider:
Hashtable properties = new Hashtable();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"org.exolab.jms.jndi.InitialContextFactory");
properties.put(Context.PROVIDER_URL, "tcp://localhost:3035/");
Context context = new InitialContext(properties);
-Tim
_____
From: openjms-user-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
[mailto:openjms-user-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of Laurent
BONANSEA
Sent: Sunday, 30 April 2006 12:04 PM
To: [email protected]
Subject: [openjms-user] Tomcat+OpenJms: Naming Exception
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
_______________________________________________ openjms-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openjms-user