activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Exception occur when JNDI lookup
Date Thu, 06 Dec 2007 10:42:38 GMT
On 06/12/2007, xy_wen <wxy2001@hotmail.com> wrote:
>
> I am using tomcat 5.5 with Activemq 4.1.1.I have written a simple test
> example to get the connectfatory and topic information using JNDI.
> this is my test client:
>          InitialContext iniContxt = new InitialContext();
>          Context contxt = (Context)
> iniContxt.lookup("java:comp/env/jmsConnectionFactory");
>          ActiveMQConnectionFactory factory =
> (ActiveMQConnectionFactory)iniContxt.lookup("jmsConnectionFactory");
>          connection = factory.createConnection();
>         session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
>         sender =
> session.createProducer((Topic)iniContxt.lookup("jmsreMsgTopic"));
>         sender.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
> But there is a exception when excute "Context contxt = (Context)
> iniContxt.lookup("java:comp/env/jmsConnectionFactory");"
> The exception is :
> Exception in thread "main" javax.naming.NamingException: scheme java not
> recognized
>         at
> org.apache.activemq.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:199)

You're using ActiveMQ's JNDI provider which is configured in the
jndi.properties rather than the web.xml (and doesn't use the java:env
stuff).

Either use the names from ActiveMQ's JNDI provider...
http://activemq.apache.org/jndi-support.html

Or switch to using your servlet containers JNDI provider
-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Mime
View raw message