2010-11-07 68 views
6

作爲我的問題標題,如何在春天爲weblogic配置jms模板?如何在spring中爲weblogic配置jms模板?

我學習的榜樣,在一些網站,但春天總是抱怨defaultDestination在JmsTemplate的

如何正確配置呢?

<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> 

注:我使用JMS的WebLogic 9.2 & Web服務器,春季2.5.6

回答

4

我發現,該目標應包含JMS目標

<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> 
+0

的'destination'豆也可需要'jndiTemplate'屬性集,就像'connectionFactory'和'jmsDestinationResolver'一樣。 – 2013-10-17 12:37:19

相關問題