IBM Solving IBM MQ Java code version mismatches using the mqjavalist.sh script - United States WebSphere MQ WMQ TECHNOTE (TROUBLESHOOTING)

PROBLEM(ABSTRACT)
 When Java™ SE applications and Java EE application servers such as WebSphere Application Server do not use a consistent set of MQ Java archives, applications can fail in unpredictable ways. If WebSphere Application Server notices a mismatch, it issues this message: "MQJCA1008 The WebSphere MQ classes for JMS were found in the class path but were not the correct version. This error can occur if the application server finds an earlier version of the WebSphere MQ classes for JMS in the class path. The error can also occur if you do not configure WebSphere Application Server to use the correct version of the WebSphere MQ classes for JMS." 

ENVIRONMENT
The mqjavalist.sh script runs on Linux and UNIX systems and can identify Java archives and classes from MQ V5.3 and later versions. Although the mqjavalist.sh script does not run on Windows systems, it is possible to zip up a directory structure on Windows in order to examine it with mqjavalist.sh on a different system. To use the mqjavalist.sh script, download it from the bottom of this page, copy it to the target system, and make the script executable. Make sure that either the unzip command or the Java jar command is available in your PATH before running mqjavalist.sh. For example:



 1. Preparing to run mqjavalist.sh
 2. 
 3.  sh> chmod +x mqjavalist.sh 
    sh> PATH=$PATH:/opt/java7/bin 
    




DIAGNOSING THE PROBLEM
IBM MQ ships a number of Java archives (jar files) that applications use to connect to MQ and work with messages. For Java EE environments, MQ provides a Resource Adapter called wmq.jmsra.rar which contains the jar files required by JMS applications. Java SE and Java EE applications must use a consistent set of MQ jar files at the same maintenance level, or else they might experience a wide variety of problems including intermittent errors, performance problems, and other failures.

It is common to find multiple versions of the MQ jar files in the Java CLASSPATH, or invalidly bundled in Java applications (.ear, .war, and .jar files). Finding and eliminating duplicate copies of the MQ jar files can be a difficult task, but the mqjavalist.sh script simplifies that task on Linux and UNIX systems.



 * Syntax
 * Examples
 * WebSphere Application Server
 * Sample output
 * Resolving problems
 * Download



SYNTAX

 1.  mqjavalist.sh -? | -h 
 2.  
 3.  mqjavalist.sh [-v] [-r] [-f File] -d Directory ...
 4.  
 5.  
 6.  
 7.  -?:
 8.  
 9.  
 10. -h:
 11. 
 12. 
 13. -v:
 14. 
 15. 
 16. -r:
 17. 
 18. 
 19. -f File​:
 20. 
 21. 
 22. -d Directory:
 23. 
 24. 
 25. 
 26. 
 27. 
 28. The mqjavalist.sh script can take several minutes to complete, depending on the number of Java archives to search and whether you perform a recursive examination of archive files. While running, the script regularly prints its status and the percentage of work completed.


Back to top



EXAMPLES

 1. Search for MQ files under /usr/IBM/WebSphere and save the results to the file mqlist.txt:
    
    mqjavalist.sh -f mqlist.txt -d /usr/IBM/WebSphere
 2. 
 3. 
 4. Perform a recursive search of archives under /opt/IBM:
    
    mqjavalist.sh -r -d /opt/IBM
 5. 
 6. 
 7. Recursively search archive files under the /opt/IBM/IIB and /opt/mqm directories and enable verbose output to ~/output.txt:
    
    mqjavalist.sh -vrf ~/output.txt -d /opt/IBM/IIB -d /opt/mqm
 8. 


Back to top



WEBSPHERE APPLICATION SERVER

WebSphere Application Server and other IBM products built on WebSphere Application Server normally show the MQ jar files in more than one location. Except as noted below, the copies of the MQ jar files should match the versions listed on this page [https://www.ibm.com/support/docview.wss?uid=swg21248089]. Any copies of the MQ jar files other than those listed below might represent a problem: 


 1. WebSphere Application Server V8.5.5, V8.5 and V8.0
 2. 
 3. 



 1. WebSphere Application Server V7.0
 2. 
 3. 
 4. 
 5. 
 6. If you created a WebSphere Application Server V7.0 profile before applying fix pack 7.0.0.1 or later, you must update the profile to use the correct MQ Resource Adapter path [https://www.ibm.com/support/knowledgecenter/SSAW57_7.0.0/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/tmj_wmqra_restoredefault.html]. Otherwise, the application servers in that profile will use the old MQ Resource Adapter jars under the profile installedConnectors/wmq.jmsra.rar directory rather than the MQ jars in the main installedConnectors/wmq.jmsra.rar directory, which are kept up to date by WebSphere Application Server fix packs.


 1. WebSphere Application Server V6.1
 2. 
 3. 



Back to top



SAMPLE OUTPUT

 1. sh> 
 2. ./mqjavalist.sh -r -f mqlist.txt -d /opt/IBM/WebSphere/AppServer
 3. 
 4.  Running mqjavalist.sh V1.4 on SUSE Linux Enterprise Server 10 (ppc) with arguments: -r -f mqlist.txt -d /opt/IBM/WebSphere/AppServer
    
    mqjavalist.sh: Searching directory /opt/IBM/WebSphere/AppServer
    mqjavalist.sh: 2180 possible Java archives found
    1.  Found 80 MQ classes in classes.jar in WMQHTTP.war in /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/cells/aemtux1Cell01/applications/WMQHTTP_war.ear/WMQHTTP_war.ear:
        root root 145600 2014-07-16 13:56 /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/cells/aemtux1Cell01/applications/WMQHTTP_war.ear/WMQHTTP_war.ear
    2.  Found 80 MQ classes in /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/aemtux1Cell01/WMQHTTP_war.ear/WMQHTTP.war/WEB-INF/lib/classes.jar:
        root root 156845 2013-09-25 18:02 /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/aemtux1Cell01/WMQHTTP_war.ear/WMQHTTP.war/WEB-INF/lib/classes.jar
    3.  Found 80 MQ classes in classes.jar in WMQHTTP.war in /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/config/cells/aemtux1Cell01/applications/WMQHTTP_war.ear/WMQHTTP_war.ear:
        root root 145600 2014-07-16 13:57 /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/config/cells/aemtux1Cell01/applications/WMQHTTP_war.ear/WMQHTTP_war.ear
    4.  Found com.ibm.mq.commonservices.jar in /opt/IBM/WebSphere/AppServer/lib/WMQ/ra/wmq.jmsra.rar:
        root root 7885592 2012-10-15 12:56 wmq.jmsra.rar
        Implementation-Title: WebSphere MQ Common Service
        Implementation-Version: ${version.number} - ${build.level}
        Implementation-Vendor: IBM Corporation
    5.  Found com.ibm.mq.connector.jar in /opt/IBM/WebSphere/AppServer/lib/WMQ/ra/wmq.jmsra.rar:
        root root 7885592 2012-10-15 12:56 wmq.jmsra.rar
        Implementation-Title: WebSphere MQ J2EE Connector Architecture
        Implementation-Version: 7.1.0.0-k000-L111005.1
        Implementation-Vendor: IBM Corporation
    6.  Found com.ibm.mq.headers.jar in /opt/IBM/WebSphere/AppServer/lib/WMQ/ra/wmq.jmsra.rar:
        root root 7885592 2012-10-15 12:56 /wmq.jmsra.rar
        Implementation-Title: WebSphere MQ classes for Java
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    7.  Found com.ibm.mq.jar in /opt/IBM/WebSphere/AppServer/lib/WMQ/ra/wmq.jmsra.rar:
        root root 7885592 2012-10-15 12:56 wmq.jmsra.rar
        Implementation-Title: WebSphere MQ classes for Java
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    8.  Found com.ibm.mq.jmqi.jar in /opt/IBM/WebSphere/AppServer/lib/WMQ/ra/wmq.jmsra.rar:
        root root 7885592 2012-10-15 12:56 wmq.jmsra.rar
        Implementation-Title: WebSphere MQ classes for Java
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    9.  Found com.ibm.mq.jmqi.local.jar in /opt/IBM/WebSphere/AppServer/lib/WMQ/ra/wmq.jmsra.rar:
        root root 7885592 2012-10-15 12:56 wmq.jmsra.rar
        Implementation-Title: WebSphere MQ classes for Java
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    10. Found com.ibm.mq.jmqi.remote.jar in /opt/IBM/WebSphere/AppServer/lib/WMQ/ra/wmq.jmsra.rar:
        root root 7885592 2012-10-15 12:56 wmq.jmsra.rar
        Implementation-Title: WebSphere MQ classes for Java
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    11. Found com.ibm.mq.jmqi.system.jar in /opt/IBM/WebSphere/AppServer/lib/WMQ/ra/wmq.jmsra.rar:
        root root 7885592 2012-10-15 12:56 wmq.jmsra.rar
        Implementation-Title: WebSphere MQ classes for Java
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    12. Found com.ibm.mq.jms.admin.jar in /opt/IBM/WebSphere/AppServer/lib/WMQ/ra/wmq.jmsra.rar:
        root root 7885592 2012-10-15 12:56 wmq.jmsra.rar
        Implementation-Title: JMS Common Client API/SPI
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    13. Found com.ibm.mq.pcf.jar in /opt/IBM/WebSphere/AppServer/lib/WMQ/ra/wmq.jmsra.rar:
        root root 7885592 2012-10-15 12:56 wmq.jmsra.rar
        Implementation-Title: WebSphere MQ classes for Java
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    14. Found com.ibm.mqjms.jar in /opt/IBM/WebSphere/AppServer/lib/WMQ/ra/wmq.jmsra.rar:
        root root 7885592 2012-10-15 12:56 wmq.jmsra.rar
        Implementation-Title: JMS Client Common Facade
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    15. Found dhbcore.jar in /opt/IBM/WebSphere/AppServer/lib/WMQ/ra/wmq.jmsra.rar:
        root root 7885592 2012-10-15 12:56 wmq.jmsra.rar
        Implementation-Version: "DH610-GOLD"
        Implementation-Title: "Webscale Distribution Hub Core"
        Implementation-Vendor: "IBM Corporation"
    16. Found /opt/IBM/WebSphere/AppServer/installedConnectors/wmq.jmsra.rar/com.ibm.mq.jmqi.jar:
        root root 1115668 2012-10-15 12:56 com.ibm.mq.jmqi.jar
        Implementation-Title: WebSphere MQ classes for Java
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    17. Found /opt/IBM/WebSphere/AppServer/installedConnectors/wmq.jmsra.rar/com.ibm.mq.commonservices.jar:
        root root 728387 2012-10-15 12:56 com.ibm.mq.commonservices.jar
        Implementation-Title: WebSphere MQ Common Service
        Implementation-Version: ${version.number} - ${build.level}
        Implementation-Vendor: IBM Corporation
    18. Found /opt/IBM/WebSphere/AppServer/installedConnectors/wmq.jmsra.rar/com.ibm.mq.jmqi.remote.jar:
        root root 546407 2012-10-15 12:56 com.ibm.mq.jmqi.remote.jar
        Implementation-Title: WebSphere MQ classes for Java
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    19. Found /opt/IBM/WebSphere/AppServer/installedConnectors/wmq.jmsra.rar/com.ibm.mq.jar:
        root root 448745 2012-10-15 12:56 com.ibm.mq.jar
        Implementation-Title: WebSphere MQ classes for Java
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    20. Found /opt/IBM/WebSphere/AppServer/installedConnectors/wmq.jmsra.rar/com.ibm.mq.jms.admin.jar:
        root root 358016 2012-10-15 12:56 com.ibm.mq.jms.admin.jar
        Implementation-Title: JMS Common Client API/SPI
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    21. Found /opt/IBM/WebSphere/AppServer/installedConnectors/wmq.jmsra.rar/com.ibm.mqjms.jar:
        root root 352254 Aug 01 11:49 com.ibm.mqjms.jar
        Implementation-Title: JMS Common Client facade
        Implementation-Version: 7.0.1.5 - k701-105-110419
        Implementation-Vendor: IBM Corporation
    22. Found /opt/IBM/WebSphere/AppServer/installedConnectors/wmq.jmsra.rar/com.ibm.mq.connector.jar:
        root root 339396 2012-10-15 12:56 com.ibm.mq.connector.jar
        Implementation-Title: WebSphere MQ J2EE Connector Architecture
        Implementation-Version: 7.1.0.0-k000-L111005.1
        Implementation-Vendor: IBM Corporation
    23. Found /opt/IBM/WebSphere/AppServer/installedConnectors/wmq.jmsra.rar/com.ibm.mq.headers.jar:
        root root 338572 2012-10-15 12:56 com.ibm.mq.headers.jar
        Implementation-Title: WebSphere MQ classes for Java
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    24. Found /opt/IBM/WebSphere/AppServer/installedConnectors/wmq.jmsra.rar/com.ibm.mq.jmqi.local.jar:
        root root 224747 2012-10-15 12:56 com.ibm.mq.jmqi.local.jar
        Implementation-Title: WebSphere MQ classes for Java
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    25. Found /opt/IBM/WebSphere/AppServer/installedConnectors/wmq.jmsra.rar/com.ibm.mq.jmqi.system.jar:
        root root 209738 2012-10-15 12:56 com.ibm.mq.jmqi.system.jar
        Implementation-Title: WebSphere MQ classes for Java
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    26. Found /opt/IBM/WebSphere/AppServer/installedConnectors/wmq.jmsra.rar/com.ibm.mq.pcf.jar:
        root root 125200 2012-10-15 12:56 com.ibm.mq.pcf.jar
        Implementation-Title: WebSphere MQ classes for Java
        Implementation-Version: 7.1.0.0 - k000-L111005.1
        Implementation-Vendor: IBM Corporation
    27. Found /opt/IBM/WebSphere/AppServer/installedConnectors/wmq.jmsra.rar/dhbcore.jar:
        root root 2011835 2012-10-15 12:56 dhbcore.jar
        Implementation-Version: "DH610-GOLD"
        Implementation-Title: "Webscale Distribution Hub Core"
        Implementation-Vendor: "IBM Corporation"
    mqjavalist.sh: 27 jar files with MQ code found in /opt/IBM/WebSphere/AppServer
    
    mqjavalist.sh: 27 total jar files with MQ code found
    mqjavalist.sh: Results saved to mqlist.txt
    
    
    
 5. 
 6. Back to top

RESOLVING THE PROBLEM

Review the output from mqjavalist.sh to determine where copies of the MQ jar files have been found. Not all duplicates represent a problem, unless they are being loaded by your Java SE application or Java EE application server at runtime. If the com.ibm.mq.commonservices.jar file shows an implementation version of ${version.number} - ${build.level} just ignore it.

In the sample output above, entries #16 through #27 represent the jar files for the installed MQ Resource Adapter. They all show an implementation version of 7.1.0.0 - k000-L111005.1 except for #21, com.ibm.mqjms.jar, which shows an implementation version of 7.0.1.5 - k701-105-110419. Because the jar file versions are not in sync, MQ JMS will not function as expected.

In cases like this, the wmq.jmsra.rar file should contain a copy of the MQ jar at the right level for the application server. Entry #14 in the mqjavalist.sh output shows the com.ibm.mqjms.jar file with an implementation version of 7.1.0.0 - k000-L111005.1, which is what we need. Use the jar program to extract the com.ibm.mqjms.jar file from the wmq.jmsra.rar archive, then copy it over the back-level version of the jar. Use chown and chmod to ensure the permissions on the file are correct.

In other cases, you might find that the classpath for the application server, or for your Java SE application, is picking up extra copies of the MQ jar files. Eliminating unnecessary classpath entries can resolve the problem.

If your Java EE application (.ear or .war) bundles a copy of any MQ jar files, you should remove them and rely on the ones from the installed MQ Resource Adapter instead.

Back to top


Additional Keywords: 
troubleshoot troubleshooting trouble shoot classloader classpath configuration scripts



DOWNLOAD
 1. 
 2. mqjavalist.sh [/support/docview.wss?uid=swg21681142&amp;aid=2]mqjavalist.sh




DISCLAIMER: All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Back to top

Question: How do I tell when there are mismatched MQ jars in my application server? Mismatched jar files can cause strange and unpredictable errors when using the MQ JMS classes from a .war file. 

Answer: If your Java EE application (.ear or .war) bundles a copy of any MQ jar files, you should remove them and rely on the ones from the installed MQ Resource Adapter instead.