1

我尝试创建类 java 可以访问 EMS 队列检查挂起的味精,但它在TibjmsAdmin admin = new TibjmsAdmin("tcp://local host:7222","admin",""); 我的简单代码下方给了我错误

public static void main(String[] args) throws TibjmsAdminException {
    TibjmsAdmin admin = new TibjmsAdmin("tcp://localhost:7222","admin","");
    String destName = null;
    QueueInfo di = admin.getQueue("test");
    StatData iStats = di.getInboundStatistics();
    StatData oStats = di.getOutboundStatistics();
    long pendingMessages = di.getPendingMessageCount();
    long pendingSize = di.getPendingMessageSize();
    long inMsgRate = iStats.getMessageRate();
    long inByteRate = iStats.getByteRate();
    long outMsgRate = oStats.getMessageRate();
    long outByteRate = oStats.getByteRate();
    System.out.println(pendingMessages);
}

我尝试做的方法可以给他队列名称它给我等待消息

错误:运行:com.tibco.tibjms.admin 的 com.tibco.tibjms.admin.MessengerUtil.(MessengerUtil.java:46) 的线程“main”java.lang.NoClassDefFoundError: com/tibco/tibjms/TibjmsQueueConnectionFactory 中的异常。 TibjmsAdmin.(TibjmsAdmin.java:424) at com.tibco.tibjms.admin.TibjmsAdmin.(TibjmsAdmin.java:405) at EMS.main(EMS.java:31) 原因:java.lang.ClassNotFoundException: com.tibco .tibjms.TibjmsQueueConnectionFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java .net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) 在 java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 还有 4 个 Java 结果:1 构建成功(总时间:0 秒)

4

1 回答 1

2

将 tibjms.jar 文件放入您的类路径

java -cp &lt;path to jar&gt;/tibjms.jar:<all my other jars>
于 2016-04-03T13:40:12.220 回答