0 Replies Latest reply: Aug 7, 2013 6:23 AM by 1009323 RSS

    LoadTesting IBM MQ using OATS

    1009323

      Hi All,

       

      Does anyone have experience using OATS for IBM MQ Testing . I am checking possibility and  had no success reading message from  MQ  in openscript. I am getting ClassNotFound Exception error message..  added all the required Jar files into the script asset folder.


      Also, how does it work to load thousands of messages into the queue.

       

      Please share you experience on this.


      My Script


      import oracle.oats.scripting.modules.basic.api.internal.*;

      import oracle.oats.scripting.modules.basic.api.*;

      import oracle.oats.scripting.modules.http.api.*;

      import oracle.oats.scripting.modules.http.api.HTTPService.*;

      import oracle.oats.scripting.modules.utilities.api.*;

      import oracle.oats.scripting.modules.utilities.api.sql.*;

      import oracle.oats.scripting.modules.utilities.api.xml.*;

      import oracle.oats.scripting.modules.utilities.api.file.*;

       

      import com.ibm.mq.MQEnvironment;

      import com.ibm.mq.MQQueueManager;

      import com.ibm.mq.MQQueue;

      import com.ibm.mq.MQMessage;

      import com.ibm.mq.*;

      import com.ibm.*;

      import com.ibm.mq.MQGetMessageOptions;

      import com.ibm.mq.MQException;

      import com.ibm.mq.constants.CMQC;

      import java.lang.*;

       

      public class script extends IteratingVUserScript {

      @ScriptService oracle.oats.scripting.modules.utilities.api.UtilitiesService utilities;

      @ScriptService oracle.oats.scripting.modules.http.api.HTTPService http;

       

      public void initialize() throws Exception {

      }

       

      /**

      * Add code to be executed each iteration for this virtual user.

      */

      public void run() throws Exception {

       

                MQQueueManager myQueueManager = null;

           MQQueue myQueue = null;

           MQEnvironment.hostname = "10.xxx.xxx.xxx"

           MQEnvironment.channel = "CHANNEL";

           MQEnvironment.port = 1234;


           // Create Connection to the MQ Manager

          myQueueManager = new MQQueueManager("MYQUEUE");


          int openOptions = CMQC.MQOO_BROWSE | CMQC.MQOO_INPUT_SHARED ;

             myQueue = myQueueManager.accessQueue("TEST",openOptions);

       

          MQGetMessageOptions getMessageOptions =new MQGetMessageOptions();

         getMessageOptions.options = CMQC.MQGMO_BROWSE_FIRST | CMQC.MQGMO_WAIT;

         getMessageOptions.waitInterval = 5000;

       

          int iCount = 0;

       

              while(true){

       

                 iCount++;

                           MQMessage getMessage = new MQMessage();

                           myQueue.get(getMessage,getMessageOptions);

       

                 byte[] b = new byte[getMessage.getMessageLength()] ;

                 getMessage.readFully(b);

                         System.out.println("Message :" + iCount);

                        String msgText = new String(b);

       

                 if (msgText.trim().equals(""))  break;

                         System.out.println(msgText);

                  getMessageOptions.options = CMQC.MQGMO_BROWSE_NEXT;

       

            }

       

       

       

            System.out.println("Closing the queue");

       

            myQueue.close();

            System.out.println("Closing the Queue Manager");

            myQueueManager.close();

            System.out.println("Done!!");

       

      }

       

      public void finish() throws Exception {

      }

      }

       

       

      Error Message

       

       

       

      0:57:11,959 ERROR [1] Error in section Unspecified at line unknown. An unexpected exception occurred in the script. Script section: Unspecified. Caused by: ClassNotFoundException occured. javax.resource.ResourceException

      1. java.lang.NoClassDefFoundError: javax/resource/ResourceException

      at com.ibm.mq.MQEnvironment.<clinit>(MQEnvironment.java:540)

      at script.run(script.java:43)

      at oracle.oats.scripting.modules.basic.api.IteratingVUser.run(IteratingVUser.java:348)

      at oracle.oats.scripting.modules.basic.api.internal.IteratingAgent.run(IteratingAgent.java:779)

      at java.lang.Thread.run(Thread.java:619)

      Caused by: java.lang.ClassNotFoundException: javax.resource.ResourceException

      at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:483)

      at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:399)

      at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:387)

      at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)

      at java.lang.ClassLoader.loadClass(ClassLoader.java:251)

      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

      ... 5 more

      10:57:12,258 INFO  [1] Finished VU 1 for script MQTestign




      ,