javatibcoems

Getting TIBCO EMS Queue


i try to create class java can acess to EMS queue check pending msg but it's give me error in line TibjmsAdmin admin = new TibjmsAdmin("tcp://local host:7222","admin",""); below my simple code

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);
}

what i try do method can give him queue name it's give me pending Msg

Error : run: Exception in thread "main" java.lang.NoClassDefFoundError: com/tibco/tibjms/TibjmsQueueConnectionFactory at com.tibco.tibjms.admin.MessengerUtil.(MessengerUtil.java:46) at com.tibco.tibjms.admin.TibjmsAdmin.(TibjmsAdmin.java:424) at com.tibco.tibjms.admin.TibjmsAdmin.(TibjmsAdmin.java:405) at EMS.main(EMS.java:31) Caused by: 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) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 4 more Java Result: 1 BUILD SUCCESSFUL (total time: 0 seconds)


Solution

  • Put the tibjms.jar file into your class path

    java -cp &lt;path to jar&gt;/tibjms.jar:<all my other jars>