You can configure your AMQ administrable objects via the Tomcat JNDI
InitialContext implementation. Here's the how-to documentation for Tomcat
6.0.
http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html
Or w/in your servlet you can create your own InitialContext based on the
jndi.properties file in your .../WEB-INF/classes directory; like so.
Properties props = new Properties();
props.load(servlet.getServletContext().getResourceAsStream("/WEB-INF/classes/jndi.properties"
));
Context jmsCtx = new InitialContext (props);
Hope this helps - Joe
Dave Carlson wrote:
>
> Hello, We are trying to connect to an ActiveMQ server from a web app. We
> are having trouble with the JNDI part of it. We have not been successful
> placing a jndi.properties file in the WEB-INF/classes, nor anywhere else.
> The properties in our JNDI file are:
>
> java.naming.factory.initial
> org.apache.activemq.jndi.ActiveMQInitialContextFactory
> queue.activity_queue activity_queue
>
> Regardless, we get a naming exception saying that activity_queue is not
> bound in this context. We are trying to get this in the following manner:
>
> Context context = new javax.naming.InitialContext();
> return context.lookup(str);
>
> This works outside of the web server, but not in. Can anyone point me in
> the right direction?
>
>
--
View this message in context: http://www.nabble.com/ActiveMQ-JNDI-in-Tomcat-tf4772699s2354.html#a13654526
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
|