Weblogic JMS URL 从 Camel 连接
Weblogic JMS URL to connect from Camel
我正在使用 WebLogic Server:12.1.1.0、Spring 3.2.11.RELEASE 和 Camel 2.13.4.
我有以下配置:
<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 服务器?
在 spring-boot 中,我正在像这样配置 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
}
解决方案实际上是在配置中使用服务器 IP 地址而不是 localhost。
我正在使用 WebLogic Server:12.1.1.0、Spring 3.2.11.RELEASE 和 Camel 2.13.4.
我有以下配置:
<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 服务器?
在 spring-boot 中,我正在像这样配置 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
}
解决方案实际上是在配置中使用服务器 IP 地址而不是 localhost。