我是JMS
的新手,正在尝试下面的示例jms
应用程序。我在websphere
控制台中创建了队列连接工厂(“jms / sampleQFactory”)和提供者队列(“jms / sampleQFactory”)。我创造了&链接系统集成总线(SIB)“sampleBus”与队列连接工厂。创建发件人队列时抛出异常。
QueueSender sender = session.createSender(queue);
public void send(){
try {
InitialContext ctx = new InitialContext();
QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("jms/sampleQFactory");
Queue queue = (Queue) ctx.lookup("q/sampleSendingQ");
ctx.close();
QueueConnection connection = factory.createQueueConnection();
QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
QueueSender sender = session.createSender(queue);
TextMessage message = session.createTextMessage(MESSAGE);
System.out.println("Sending Message --- " + MESSAGE);
sender.send(message);
connection.close();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JMSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
我收到以下错误:
[6/11/14 9:02:34:435 IST] 00000029 SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
[6/11/14 9:02:34:435 IST] 00000029 SystemErr R Caused by: com.ibm.ws.sib.processor.exceptions.SIMPNotPossibleInCurrentConfigurationException: CWSIK0015E: The destination sampleSendingQ was not found on messaging engine SB02861Node01.server1-SampleBus.
at com.ibm.ws.sib.processor.impl.DestinationManager.checkDestinationHandlerExists(DestinationManager.java:3855)
at com.ibm.ws.sib.processor.impl.DestinationManager.getDestination(DestinationManager.java:966)
at com.ibm.ws.sib.processor.impl.ConnectionImpl.internalCreateProducerSession(ConnectionImpl.java:1007)
at com.ibm.ws.sib.processor.impl.ConnectionImpl.createProducerSession(ConnectionImpl.java:868)
at com.ibm.ws.sib.api.jms.impl.JmsMsgProducerImpl.<init>(JmsMsgProducerImpl.java:385)
at com.ibm.ws.sib.api.jms.impl.JmsQueueSenderImpl.<init>(JmsQueueSenderImpl.java:75)
at com.ibm.ws.sib.api.jms.impl.JmsQueueSessionImpl.instantiateProducer(JmsQueueSessionImpl.java:361)
at com.ibm.ws.sib.api.jms.impl.JmsSessionImpl.createProducer(JmsSessionImpl.java:1101)
at com.ibm.ws.sib.api.jms.impl.JmsQueueSessionImpl.createSender(JmsQueueSessionImpl.java:236)
at net.viralpatel.spring3.messaging.MessageProducer.send(MessageProducer.java:31)
at net.viralpatel.spring3.controller.HelloWorldController.processRequest(HelloWorldController.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1103)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:570)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:486)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:748)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1461)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:118)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:267)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
[6/11/14 9:02:34:435 IST] 00000029 SystemErr R at com.ibm.ws.sib.processor.impl.DestinationManager.checkDestinationHandlerExists(DestinationManager.java:3855)
[6/11/14 9:02:34:435 IST] 00000029 SystemErr R at com.ibm.ws.sib.processor.impl.DestinationManager.getDestination(DestinationManager.java:966)
[6/11/14 9:02:34:435 IST] 00000029 SystemErr R at com.ibm.ws.sib.processor.impl.ConnectionImpl.internalCreateProducerSession(ConnectionImpl.java:1007)
[6/11/14 9:02:34:435 IST] 00000029 SystemErr R at com.ibm.ws.sib.processor.impl.ConnectionImpl.createProducerSession(ConnectionImpl.java:868)
[6/11/14 9:02:34:435 IST] 00000029 SystemErr R at com.ibm.ws.sib.api.jms.impl.JmsMsgProducerImpl.<init>(JmsMsgProducerImpl.java:385)
[6/11/14 9:02:34:435 IST] 00000029 SystemErr R ... 39 more
请帮忙。
答案 0 :(得分:0)
我发现您使用相同的名称来表示消息队列和队列连接工厂。因为服务集成技术总是首先在本地查找JMS目标,如果它们无法在本地找到目标,则只使用完整的JNDI引用。
答案 1 :(得分:0)
看起来你错过了公交车上的队列:
CWSIK0015E:在消息传递引擎SB02861Node01.server1-SampleBus上找不到目标sampleSendingQ
在管理控制台中,转到:服务整合&gt;公共汽车&gt; myBus
Bus Members
部分检查中,如果您的服务器已添加到总线(如果没有添加)Destinations
部分,点击“新建”以在总线上定义队列(sampleSendingQ)Resources > JMS > Queues
选择您定义的队列中 - 您应该能够选择正确的总线和已创建的队列(如果没有,请再次创建jms队列)那你应该没问题。