IBM MQ PCFMessage代理,用于通道状态

时间:2015-10-26 12:09:20

标签: ibm-mq

我正在尝试使用PCFMessageAgent检索远程队​​列管理器的通道状态。当我尝试创建它的实例时,我收到以下错误。

Exception in thread "main" java.lang.NoClassDefFoundError:
com/ibm/mq/internal/MQCommonServices    at
com.ibm.mq.pcf.PCFAgent.getJmqiEnv(PCFAgent.java:124)   at
com.ibm.mq.pcf.PCFAgent.<init>(PCFAgent.java:132)   at
com.ibm.mq.pcf.PCFAgent.<init>(PCFAgent.java:146)   at
com.ibm.mq.pcf.PCFMessageAgent.<init>(PCFMessageAgent.java:126)     at
com.sample.model.Test2.main(Test2.java:77) Caused by:
java.lang.ClassNotFoundException: com.ibm.mq.internal.MQCommonServices
    at java.net.URLClassLoader$1.run(Unknown Source)    at
java.net.URLClassLoader$1.run(Unknown Source)   at
java.security.AccessController.doPrivileged(Native Method)  at
java.net.URLClassLoader.findClass(Unknown Source)   at
java.lang.ClassLoader.loadClass(Unknown Source)     at
sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)  at
java.lang.ClassLoader.loadClass(Unknown Source)     ... 5 more 

作为参考,我将代码放在这里。

    MQEnvironment.hostname = hostname;           
    MQEnvironment.port  = port;            
    MQEnvironment.channel = channel;
    MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);
    MQQueueManager qMgr=null;
    PCFMessageAgent agent =null;
         try {
            qMgr = new MQQueueManager(qManager);
            agent = new PCFMessageAgent (qMgr);
            mes= new PCFMessage(CMQCFC.MQCMD_INQUIRE_CHANNEL_STATUS);
            mes.addParameter(CMQCFC.MQCACH_CHANNEL_NAME, "*");
            mes.addParameter(CMQCFC.MQIACH_CHANNEL_TYPE, CMQXC.MQCHT_ALL);
            mes.addParameter(CMQCFC.MQIACH_CHANNEL_INSTANCE_ATTRS,
                              new int []
                              {
                                 CMQCFC.MQCACH_CHANNEL_NAME,
                                 CMQCFC.MQCACH_CONNECTION_NAME,
                                 CMQCFC.MQIACH_CHANNEL_STATUS,
                                 CMQCFC.MQIACH_CHANNEL_SUBSTATE,
                                 CMQCFC.MQIACH_MSGS,
                                 CMQCFC.MQCACH_LAST_MSG_DATE,
                                 CMQCFC.MQCACH_LAST_MSG_TIME,
                                 CMQCFC.MQCACH_CHANNEL_START_DATE,
                                 CMQCFC.MQCACH_CHANNEL_START_TIME,
                                 CMQCFC.MQIACH_BYTES_SENT,
                                 CMQCFC.MQIACH_BYTES_RECEIVED,
                                 CMQCFC.MQIACH_BUFFERS_SENT,
                                 CMQCFC.MQIACH_BUFFERS_RECEIVED,
                                 CMQCFC.MQIACH_MCA_STATUS,
                                 CMQCFC.MQCACH_MCA_JOB_NAME,
                                 CMQCFC.MQCACH_MCA_USER_ID
                              } );
                  res = agent.send(mes);
                  }
                  catch(Exception e){
                  e.printStackTrace();
                  }

我已经包含了

  1. com.ibm.mq.jar
  2. com.ibm.mq.headers.jar
  3. com.ibm.mq.commonservices.jar
  4. com.ibm.mq.jmqi.jar
  5. com.ibm.mq.pcf.jar
  6. com.ibm.mqjms.jar
  7. connector.jar
  8. dhbcore.jar
  9. fscontext.jar
  10. providerutil.jar
  11. 此外,我尝试使用PCFMessageAgent的其他构造函数创建实例。每次都抛出相同的异常。注意:我能够连接到队列管理器并执行诸如获取或将消息放入队列等操作。

    谁能告诉我在这里可能错过了什么? 还有其他人遇到过同样的问题吗? 提前谢谢。

0 个答案:

没有答案