Support Article
Unable to locate the external jar- Connect MQ throws exception
SA-11853
Summary
In the process of migrating the IBM sparc system to Intel x86 system for an existing PRPC 6.1 SP2, an issue with the classpaths was discovered
In previous environment:
1.The com.ibm.mq.jar, needed for MQ, was deployed to the App Servers lib directory (/opt/mqm/java/lib)
2. The external jar classpath was set to the compiler defaultPath's data-admin-system-settings as /opt/mqm/java/lib/com.ibm.mq.jar, while compiler/defaultClasses was empty
The above scenario works perfectly with no exception or problem in the conect-mq method.
In x86- the database have been fully copied from the old to the new system using the oracle data pump process.
1. The com.ibm.mq.jar required for MQ is deployed to the App Servers lib directory (/opt/mqm/java/lib),compiler/defaultClasses is empty as before.
2. More libraries are required so user creates one WAS env variable (according to the IBM doc) at the Node and deployment manager MQ_JAVA_LIB_PATH and specified the classpath opt/mqm/java/lib and removes the system-settings entry as it is no more required. This variable is set globally and all applications running in the web sphere should have this path set.
After the changes the errors were observed.
Error Messages
16 09:32:14,634 [ MQ-Thread-50] [ STANDARD] [ iPI_APAC:06.03.01] ( internal.cache.FUACacheImpl) ERROR MQ.IPI_APAC_DEV_LOCAL.iPI_APAC|MQ|iPI_APAC|Pich|IPI_APAC_LOCAL|AD0D6FDB53A0D39C29F4B89F206760F27 [email protected] - Failed to generate com.pegarules.generated.activity.ra_action_invokemqconnector_13462f6c3a79b24f1deddcd9786cbef7
com.pega.pegarules.pub.generator.FirstUseAssemblerException: Failed to compile generated Java com.pegarules.generated.activity.ra_action_invokemqconnector_13462f6c3a79b24f1deddcd9786cbef7: ----------
1. ERROR in com/pegarules/generated/activity/ra_action_invokemqconnector_13462f6c3a79b24f1deddcd9786cbef7.java (at line 228)
com.ibm.mq.MQQueueManager qmRequest = null;
^^^^^^^^^^
com.ibm.mq cannot be resolved to a type
----------
----------
5. ERROR in com/pegarules/generated/activity/ra_action_invokemqconnector_13462f6c3a79b24f1deddcd9786cbef7.java (at line 236)
com.ibm.mq.MQEnvironment.disableTracing();
^^^^^^^^^^^^^^^^^^^^^^^^
com.ibm.mq.MQEnvironment cannot be resolved to a type
----------
6. ERROR in com/pegarules/generated/activity/ra_action_invokemqconnector_13462f6c3a79b24f1deddcd9786cbef7.java (at line 237)
com.ibm.mq.MQException.log = null;
^^^^^^^^^^^^^^^^^^^^^^
com.ibm.mq.MQException cannot be resolved
----------
----------
11. ERROR in com/pegarules/generated/activity/ra_action_invokemqconnector_13462f6c3a79b24f1deddcd9786cbef7.java (at line 695)
com.ibm.mq.MQEnvironment.properties.put(com.ibm.mq.MQC.TRANSPORT_PROPERTY,com.ibm.mq.MQC.TRANSPORT_MQSERIES_BINDINGS);
^^^^^^^^^^^^^^
com.ibm.mq.MQC cannot be resolved
----------
Steps to Reproduce
Run the test connectivity of any connect-mq listener.
Root Cause
Adding the global variable does not mean the jars in that path is picked up, explanation on how our class loaders work and how to specify external jars provided.
Resolution
Those are two basic concepts to understand initially
Here is some in formation on adding third party jar or java class files to the class path this can be done in the following manner:
Runtime Class Path
To add the jar or Java class file to the runtime class path, place it in a directory where it will be loaded by one of the classloaders in the classloader hierarchy.
The best approach is to use or create a shared directory in the application server level of the directory structure. For example:
- For Tomcat, put it in the common\lib directory.
- For WebSphere, use the admin console to create a Shared Library and put the .jar file there.
- For WebLogic, put it in the common\lib directory.
Compile Time Class Path
To add a jar or Java class to the compile time class path, use the compiler's dynamic system settings. Complete the following steps:
1. Add the jar or Java class file to the runtime class path. (Verify that the Java class or jar file is located in Process Commander's classloader hierarchy.)
2. In Process Commander, from the Rules by Type explorer, select SysAdmin > Dynamic System Settings.
3. Select either the compiler/defaultClasses setting or the compiler/defaultPaths setting, as appropriate.
4. If you are using the compiler/defaultClasses setting, enter the fully qualified Java class name. If you are using the compiler/defaultPaths setting, enter the full path to and name of the jar, or the path to and directory name of the unarchived Java classes. In either case, use semicolons (;) to separate entries from each other in the Value field.
5. Save the setting.
6. From the menu, select Tools > System Management Application.
7. In the System Management application, select Advanced > Class Loader Management.
8. Click Refresh External Jars to add the class or jar to the compile time class path. If it is already included, it is not added again.
The issue was resolved by using the DefaultClasses setting.
Published July 30, 2015 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.