What JNDI environment properties do I use for Jetty?
I'm running jetty-6.1.7 and I've got an ActiveMQConnectionFactory tha开发者_StackOverflowt I'd like to reference in my spring configuration via a JNDITemplate.
My jetty.xml configuration is vanilla:
<New id="connectionFactory" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jms/connectionFactory</Arg>
<Arg>
<New class="org.apache.activemq.ActiveMQConnectionFactory">
<Arg>vm://localhost?broker.persistent=true</Arg>
</New>
</Arg>
</New>
And I can't find what the right thing is to put in the JNDI Template in my spring config:
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial"> ???? </prop>
<prop key="java.naming.provider.url"> ???? </prop>
</props>
</property>
</bean>
<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="jndiName">
<value>jms/connectionFactory</value>
</property>
</bean>
Thanks in advance!
For jetty 6, these are the JNDI properites
java.naming.factory.url.pkgs=org.mortbay.naming
java.naming.factory.initial=org.mortbay.naming.InitialContextFactory
While I didn't try it myself, something like this should work
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">
org.apache.activemq.jndi.ActiveMQInitialContextFactory
</prop>
<prop key="java.naming.provider.url">
tcp://localhost:61616
</prop>
</props>
</property>
</bean>
精彩评论