从骆驼路线向Weblogic JMS队列发送消息 [英] Sending message to Weblogic JMS Queue from a Camel Route

查看:144
本文介绍了从骆驼路线向Weblogic JMS队列发送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过骆驼路线将消息放入Weblogic JMS中的队列.

I am trying to put a message on a Queue in Weblogic JMS, via a Camel Route.

我的目标是最终配置一个路由,以使用来自jms队列的消息,并向其中发布来自较早Route的数据.

My aim is to eventually configure a Route to consume the messages from the jms queue to which I publish the data from the earlier Route.

这是我的配置:

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

<!-- Gets a Weblogic JMS Connection factory object from JDNI Server by jndiName--> 
<bean id="webLogicJmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiTemplate" ref="jndiTemplate" />
    <property name="jndiName" value="jms/TestConnectionFactory" />  <!-- the connection factory object is store under this name -->
</bean>

<!-- Create a new WebLogic Jms Camel Component -->
<bean id="wmq" class="org.apache.camel.component.jms.JmsComponent">
   <property name="connectionFactory" ref="webLogicJmsConnectionFactory"/>
</bean>

我的路线如下:

from("cxfrs:bean:rsServer")
     .setBody().body(TestRequest.class)
     .process(new Processor(){
        @Override
        public void process(Exchange exchange) throws Exception {
            TestRequest request = exchange.getIn().getBody(TestRequest.class);
            TestResponse response = new TestResponse();
            response.setAddress(request.getAddress());
            response.setName(request.getName());
        }

     }).to("wmq:queue:TestJMSQueue");

当我尝试执行此Route时遇到此异常:

I am getting this exception when I try to execute this Route:

May 27, 2013 6:37:47 PM org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
WARNING: javax.ws.rs.WebApplicationException: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is weblogic.jms.common.JMSException: [JMSExceptions:045101]The destination name passed to createTopic or createQueue "TestJMSModule!TestJMSQueue" is invalid. If the destination name does not contain a "/" character then it must be the name of a distributed destination that is available in the cluster to which the client is attached. If it does contain a "/" character then the string before the "/" must be the name of a JMSServer or a ".". The string after the "/" is the name of a the desired destination. If the "./" version of the string is used then any destination with the given name on the local WLS server will be returned.
at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.returnResponse(CxfRsInvoker.java:149)
at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.asyncInvoke(CxfRsInvoker.java:104)
at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:57)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:167)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:94)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor
...
Caused by: weblogic.jms.common.JMSException: [JMSExceptions:045101]The destination name passed to createTopic or createQueue "TestJMSModule!TestJMSQueue" is invalid. If the destination name does not contain a "/" character then it must be the name of a distributed destination that is available in the cluster to which the client is attached. If it does contain a "/" character then the string before the "/" must be the name of a JMSServer or a ".". The string after the "/" is the name of a the desired destination. If the "./" version of the string is used then any destination with the given name on the local WLS server will be returned.
at weblogic.jms.frontend.FEManager.destinationCreate(FEManager.java:202)
at weblogic.jms.frontend.FEManager.invoke(FEManager.java:544)
at weblogic.messaging.dispatcher.Request.wrappedFiniteStateMachine(Request.java:961)
at weblogic.messaging.dispatcher.DispatcherImpl.syncRequest(DispatcherImpl.java:184)
at weblogic.messaging.dispatcher.DispatcherImpl.dispatchSyncNoTran(DispatcherImpl.java:287)
at weblogic.jms.dispatcher.DispatcherAdapter.dispatchSyncNoTran(DispatcherAdapter.java:59)
at weblogic.jms.client.JMSSession.createDestination(JMSSession.java:3118)
at weblogic.jms.client.JMSSession.createQueue(JMSSession.java:2514)

我遵循了创建此处提到的队列的过程: https://blogs.oracle.com /soaproactive/entry/how_to_create_a_simple

I followed the procedure to create a Queue mentioned here: https://blogs.oracle.com/soaproactive/entry/how_to_create_a_simple

我正在创建一个JMS模块(TestJMSModule),并在其中创建一个队列(TestJMSQueue)和其中的连接工厂.

I am creating a JMS Module(TestJMSModule) and in that I am creating a Queue(TestJMSQueue) and a connection factory inside it.

我是JMS的新手,我知道我在Camel端或Weblogic端的配置有问题,但是无法弄清楚是什么.任何帮助将不胜感激.

I am new to JMS and I know I am doing something wrong with the configurations either on the Camel side or the Weblogic side, but not able to figure out what. Any help would be greatly appreciated.

谢谢.

推荐答案

您需要创建JMS服务器.然后,您需要在JMS模块中创建一个子部署,然后将该子部署定位到JMS服务器.

You need to create a JMS Server. Then you need to create a subdeployment in your JMS Module and then target the subdeployment to the JMS Server.

然后语法必须是 JMSServer/JMSModule!Queue

Then the syntax needs to be JMSServer/JMSModule!Queue

这篇关于从骆驼路线向Weblogic JMS队列发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆