MQ: Verbindung zu host abgelehnt | Kanal-Verhandlung gescheitert

Hallo, ich habe ein großes problem mit der Verbindung zu IBM WebSphere MQ mit JMS

Ich benutze:

  • Win 7
  • JDK 1.7
  • IBM WebSphere MQ server 7.5.0.2
  • GlassFish 4.0

Ich eines QueueManager namens test1 und einer Warteschlange in der benannten test1q und ein Kanal für die Verhandlungen benannt test1channel

Mein code ist hier:

StandaloneSender s = new StandaloneSender();
try{
    s.send(“hello word”);
}catch (Exception e){
    e.printStackTrace();
}

StandaloneSender.java

import javax.jms.Message;
import javax.jms.QueueConnection;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.naming.NamingException;

public class StandaloneSender {
    private P2PUtils utils;
    private QueueConnection connection;
    private QueueSession session;
    private QueueSender sender;
    public void send(String message) throws NamingException, JMSException, IOException {
        StandaloneSender sender = new StandaloneSender();
        sender.connect();
        sender.sendMessage(message);
        sender.disconnect();
    }

    public StandaloneSender() {
        utils = new P2PUtils();
    }

    private void connect() throws NamingException, JMSException {
        connection = utils.getConnection();
        session =
            connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        sender = session.createSender(utils.getQueue());
        System.out.println("Sender started.");
    }

    private void sendMessage(String text) throws JMSException {
        Message message = session.createTextMessage(text);
        sender.send(message);
        System.out.println(
            "Sent message <"
                + text
                + "> with ID <"
                + message.getJMSMessageID()
                + ">");
    }
    private void disconnect() throws JMSException {
        sender.close();
        session.close();
        connection.close();
        System.out.println("Sender stopped.");
    }
}

P2PUtils.java

import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.naming.Context;
import javax.naming.NamingException;

public class P2PUtils extends JmsUtils {

    private static final String QCF_NAME = "test1";
    private static final String QUEUE_NAME = "test1q";

    public QueueConnection getConnection() throws NamingException, JMSException {
        Context context = getInitialContext();
        QueueConnectionFactory qcf =
            (QueueConnectionFactory) context.lookup(QCF_NAME);
        return qcf.createQueueConnection();
    }

    public Queue getQueue() throws NamingException {
        Context context = getInitialContext();
        return (Queue) context.lookup(QUEUE_NAME);
    }
}

JmsUtils.java

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class JmsUtils {
    private static final String CF_CLASS_NAME = "com.ibm.mq.jms.context.WMQInitialContextFactory";
    private static final String WMQ_URL = "localhost:1414/SYSTEM.DEF.SVRCONN";

    protected Context getInitialContext() throws NamingException {
        Properties props = new Properties();
        props.put(Context.INITIAL_CONTEXT_FACTORY, CF_CLASS_NAME);
        props.put(Context.PROVIDER_URL, WMQ_URL);
        return new InitialContext(props);
    }
}

Aber ich habe diese Ausnahme von glassfish:

[2014-02-17T16:35:25.286+0330] [glassfish 4.0] [SEVERE] [] [] [tid: _ThreadID=25 _ThreadName=Thread-4] [timeMillis: 1392642325286] [levelValue: 1000] [[
  javax.naming.ServiceUnavailableException: Unable to connect to the target queue manager localhost:1414/SYSTEM.DEF.SVRCONN [Root exception is com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2539'.]
    at com.ibm.mq.jms.context.MQContext.<init>(MQContext.java:196)
    at com.ibm.mq.jms.context.WMQInitialContextFactory.getInitialContext(WMQInitialContextFactory.java:29)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
    at javax.naming.InitialContext.init(InitialContext.java:242)
    at javax.naming.InitialContext.<init>(InitialContext.java:216)
    at com.surena.MQ.JmsUtils.getInitialContext(JmsUtils.java:17)
    at com.surena.MQ.P2PUtils.getConnection(P2PUtils.java:16)
    at com.surena.MQ.StandaloneSender.connect(StandaloneSender.java:32)
    at com.surena.MQ.StandaloneSender.send(StandaloneSender.java:22)
    at com.surena.servlet.MainServlet.doGet(MainServlet.java:50)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
    at java.lang.Thread.run(Thread.java:744)
Caused by: com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2539'.
    at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:247)
    at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:588)
    at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:630)
    at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:107)
    at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:205)
    at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:911)
    at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:799)
    at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:750)
    at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:157)
    at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:757)
    at com.ibm.mq.pcf.PCFAgent.connect(PCFAgent.java:230)
    at com.ibm.mq.pcf.PCFAgent.<init>(PCFAgent.java:163)
    at com.ibm.mq.pcf.PCFMessageAgent.<init>(PCFMessageAgent.java:140)
    at com.ibm.mq.jms.context.MQContext.<init>(MQContext.java:183)
    ... 39 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2539;AMQ9204: Connection to host 'localhost(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2539;AMQ9503: Channel negotiation failed. [3=SYSTEM.DEF.SVRCONN]],3=localhost(1414),5=RemoteConnection.initSess]
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2053)
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1226)
    at com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJmqiImpl.java:311)
    at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:337)
    at com.ibm.mq.MQSESSION.MQCONNX_j(MQSESSION.java:924)
    at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:236)
    ... 52 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2539;AMQ9503: Channel negotiation failed. [3=SYSTEM.DEF.SVRCONN]
    at com.ibm.mq.jmqi.remote.impl.RemoteConnection.initSess(RemoteConnection.java:1111)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:727)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:400)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:299)
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:164)
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1598)
    ... 57 more]]

Und das von IBM MQ

2/17/2014 14:41:51 - Process(3924.1) User(MUSR_MQADMIN) Program(runmqlsr.exe)
                      Host(PROGRAMMER1) Installation(Installation1)
                      VRMF(7.5.0.2)
AMQ6118: An internal WebSphere MQ error has occurred (20006047)

EXPLANATION:
An error has been detected, and the MQ error recording routine has been called.
ACTION:
Use the standard facilities supplied with your system to record the problem
identifier and to save any generated output files. Use either the MQ Support
site: http://www.ibm.com/software/integration/wmq/support/, or IBM Support
Assistant (ISA): http://www.ibm.com/software/support/isa/, to see whether a
solution is already available.  If you are unable to find a match, contact your
IBM support center.  Do not discard these files until the problem has been
resolved. 
----- amqxfdcp.c : 867 --------------------------------------------------------
2/17/2014 14:41:51 - Process(3924.1) User(MUSR_MQADMIN) Program(runmqlsr.exe)
                      Host(PROGRAMMER1) Installation(Installation1)
                      VRMF(7.5.0.2)
AMQ6184: An internal WebSphere MQ error has occurred on queue manager test1    
                                      .

EXPLANATION:
An error has been detected, and the WebSphere MQ error recording routine has
been called. The failing process is process 3924.
ACTION:
Use the standard facilities supplied with your system to record the problem
identifier and to save any generated output files. Use either the MQ Support
site: http://www.ibm.com/software/integration/wmq/support/, or IBM Support
Assistant (ISA): http://www.ibm.com/software/support/isa/, to see whether a
solution is already available.  If you are unable to find a match, contact your
IBM support center.  Do not discard these files until the problem has been
resolved.

Ich habe alle jar-Datei enthalten, die in MQ-Installationsverzeichnis

bitte helfen Sie mir.

InformationsquelleAutor EN20 | 2014-02-17
Schreibe einen Kommentar