2015-04-22 90 views
-1

我使用的是WebLogic Server:12.1.1.0,Spring 3.2.11.RELEASE和Camel 2.13.4。從Camel連接的Weblogic JMS URL

我有以下配置:

<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> 
      <prop key="java.naming.security.principal">username</prop> 
      <prop key="java.naming.security.credentials">the_password</prop> 
     </props> 
    </property> 
</bean> 

,但我得到的部署後,此消息:

22-apr-2015 18.29.39 org.springframework.jms.listener.DefaultMessageListenerContainer refreshConnectionUntilSuccessful 
GRAVE: Could not refresh JMS Connection for destination 'CamelTest' - retrying in 5000 ms. Cause: JndiObjectTargetSource failed to obtain new target object; nested exception is javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3://localhost:7001: Destination unreachable; nested exception is: 
    java.net.ConnectException: Connection refused; No available router to destination] 

我怎樣才能連接到JMS服務器?

+0

Downvoter,downvote的原因是什麼? –

回答

1

春天引導我配置JMS這樣

@Configuration 
@EnableJms 
public class JmsConfiguration implements JmsListenerConfigurer { 
    ... 
    // register here your jms listners 
    @Override 
    public void configureJmsListeners{ 
    ... 
    } 
} 

的然後做你想做的,當你收到

@Override 
@JmsListener(destination = "queue") 
public void processQueue(ResponseType response){ 

     //process message as you want 
} 
+0

您使用的是weblogic嗎?你如何設置連接工廠?你能不能也請張貼你的Spring配置文件? –

+0

在JmsConfiguration中我使用@autowired註釋了工廠, – danielgmarcos

0

該解決方案實際上是利用服務器的IP地址而不是消息本地主機的配置。