获取TIBCO EMS队列

时间:2016-04-03 09:21:02

标签: java tibco ems

我尝试创建类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);
}

我尝试做什么方法可以给他排队名称它给我等待消息

  

错误:   跑:   线程" main"中的例外情况java.lang.NoClassDefFoundError:com / tibco / tibjms / TibjmsQueueConnectionFactory       在com.tibco.tibjms.admin.MessengerUtil。(MessengerUtil.java:46)       在com.tibco.tibjms.admin.TibjmsAdmin。(TibjmsAdmin.java:424)       在com.tibco.tibjms.admin.TibjmsAdmin。(TibjmsAdmin.java:405)       在EMS.main(EMS.java:31)   引起:java.lang.ClassNotFoundException:com.tibco.tibjms.TibjmsQueueConnectionFactory       在java.net.URLClassLoader $ 1.run(URLClassLoader.java:366)       在java.net.URLClassLoader $ 1.run(URLClassLoader.java:355)       at java.security.AccessController.doPrivileged(Native Method)       在java.net.URLClassLoader.findClass(URLClassLoader.java:354)       at java.lang.ClassLoader.loadClass(ClassLoader.java:425)       at sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:308)       at java.lang.ClassLoader.loadClass(ClassLoader.java:358)       ......还有4个   Java结果:1   建立成功(总时间:0秒)

1 个答案:

答案 0 :(得分:2)

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

java -cp< jar的路径> /tibjms.jar: