how to configure jms template at spring for weblogic?
Asked Answered
H

1

8

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

Houseyhousey answered 7/11, 2010 at 11:30 Comment(0)
H
5

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>
Houseyhousey answered 14/11, 2010 at 14:0 Comment(1)
The destination bean may also need the jndiTemplate property set, as is done for connectionFactory and jmsDestinationResolver.Bassinet

© 2022 - 2024 — McMap. All rights reserved.