Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将消息发送到远程JMS队列_Jms_Weblogic - Fatal编程技术网

将消息发送到远程JMS队列

将消息发送到远程JMS队列,jms,weblogic,Jms,Weblogic,我在cluster1_机器1和cluster2_机器2上部署了一个应用程序。队列位于群集1\u机器1中 在cluster1_machine1中使用应用程序可以发送和接收消息,但在cluster2_machine2中向cluster1_machine1中的队列发送消息是失败的 我一直在获取以下异常,我知道异常是由于以下代码引发的 WLSession s = (WLSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

我在cluster1_机器1和cluster2_机器2上部署了一个应用程序。队列位于群集1\u机器1中

在cluster1_machine1中使用应用程序可以发送和接收消息,但在cluster2_machine2中向cluster1_machine1中的队列发送消息是失败的

我一直在获取以下异常,我知道异常是由于以下代码引发的

WLSession s = (WLSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
例外情况:

java.lang.AbstractMethodError: retrieveThreadLocalContext
    at weblogic.messaging.dispatcher.DispatcherProxy.unmarshalResponse(DispatcherProxy.java:243)
    at weblogic.messaging.dispatcher.DispatcherProxy.dispatchSyncTranFuture(DispatcherProxy.java:134)
    at weblogic.messaging.dispatcher.DispatcherWrapperState.dispatchSyncTran(DispatcherWrapperState.java:334)
    at weblogic.messaging.dispatcher.DispatcherWrapperState.dispatchSyncNoTran(DispatcherWrapperState.java:381)
    at weblogic.messaging.dispatcher.DispatcherWrapperState.dispatchSync(DispatcherWrapperState.java:249)
    at weblogic.jms.dispatcher.DispatcherAdapter.dispatchSync(DispatcherAdapter.java:43)
    at weblogic.jms.client.JMSConnection.setupJMSSession(JMSConnection.java:529)
    at weblogic.jms.client.JMSConnection.createSessionInternal(JMSConnection.java:497)
    at weblogic.jms.client.JMSConnection.createSession(JMSConnection.java:483)
    at weblogic.jms.client.WLConnectionImpl.createSession(WLConnectionImpl.java:552)
    at jsp_servlet.__enqueue._jspService(__enqueue.java:198)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
    at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:416)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:327)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:184)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3750)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3714)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2283)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2182)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1491)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
请帮忙。谢谢大家!

生产商代码:

try {
        InitialContext ic = getInitialContext("t3://cluster2_machine2:<PORT>");
        ConnectionFactory qconFactory = (ConnectionFactory) ic.lookup("jms/TestConnectionFactory");
        Connection connection = qconFactory.createQueueConnection();
        WLSession s = (WLSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Destination queue = (Destination) ic.lookup("jms/TestJMSQueue");
        WLMessageProducer producer = (WLMessageProducer) s.createProducer(null);
        TextMessage msg = s.createTextMessage();
        connection.start();

        msg.setText(strMsg);
        producer.send(queue,msg);

        producer.close();
        s.close();
        connection.close();

    } catch (Exception e) {
        e.printStackTrace();
    }

private static InitialContext getInitialContext(String url)
            throws NamingException {
        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);
        env.put(Context.PROVIDER_URL, url);
        return new InitialContext(env);
    }

我认为我们需要更多地了解客户机/发送方代码,以了解如何配置JMS和上下文。该错误似乎表明它正在本地主机上查找队列,而不是远程主机。谢谢您的评论,代码已更新。