views:

470

answers:

2

Hi,

I'm running jetty-6.1.7 and I've got an ActiveMQConnectionFactory that 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!

A: 

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>
Dejan Bosanac
A: 

For jetty 6, these are the JNDI properites

java.naming.factory.url.pkgs=org.mortbay.naming
java.naming.factory.initial=org.mortbay.naming.InitialContextFactory
Chandra Patni