how to configure jms template at spring for weblogic?

Jeg Bagus picture Jeg Bagus · Nov 7, 2010 · Viewed 17.6k times · Source

as my question title, how to configure jms template at spring for weblogic?

i follow an example at some website, but spring always complain about defaultDestination at JmsTemplate

how to configure it correctly ?

<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
    <property name="environment">
        <props>
            <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
            <prop key="java.naming.provider.url">t3://localhost:7001</prop>
        </props>
    </property>
</bean>

<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiTemplate" ref="jndiTemplate" />
    <property name="jndiName" value="jms/confactory" />
</bean>

<bean id="jmsDestinationResolver" class="org.springframework.jms.support.destination.JndiDestinationResolver">
    <property name="jndiTemplate" ref="jndiTemplate" />
    <property name="cache" value="true" />
</bean>

<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="connectionFactory" />
    <property name="destinationResolver" ref="jmsDestinationResolver" />
</bean>

nb : i use weblogic 9.2 for jms & web server, spring 2.5.6

Answer

Jeg Bagus picture Jeg Bagus · Nov 14, 2010

i find out, that destination should contain jms destination

<bean id="destination" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="jms/queue" />
</bean>

<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="connectionFactory" />
    <property name="destinationResolver" ref="jmsDestinationResolver" />
    <property name="defaultDestination" ref="destination" />
    <property name="sessionAcknowledgeModeName" value="CLIENT_ACKNOWLEDGE"/>
    <property name="sessionTransacted" value="true" />
</bean>