IBM Support

Solving IBM MQ Java code version mismatches using the mqjavalist.sh script

Troubleshooting


Problem

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:

    Preparing to run mqjavalist.sh


      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


    mqjavalist.sh -? | -h
    mqjavalist.sh [-v] [-r] [-f File] -d Directory ...


    &ensp&ensp&ensp&ensp&ensp&ensp&ensp&ensp&ensp&ensp-?:&emspDisplay help
    &ensp&ensp&ensp&ensp&ensp&ensp&ensp&ensp&ensp&ensp-h:&emspDisplay help
    &ensp&ensp&ensp&ensp&ensp&ensp&ensp&ensp&ensp&ensp-v:&emspGenerate verbose output
    &ensp&ensp&ensp&ensp&ensp&ensp&ensp&ensp&ensp&ensp-r:&emspRecursively examine embedded archive files
    &ensp&ensp&ensp&ensp&ensp-f File​:&emspThe output file name for the search results
    -d Directory:&emspA directory to search for MQ classes and archives






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. Perform a recursive search of archives under /opt/IBM:

    mqjavalist.sh -r -d /opt/IBM


  3. 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




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. Any copies of the MQ jar files other than those listed below might represent a problem:


    WebSphere Application Server V8.5.5, V8.5 and V8.0


    Each installation of WebSphere Application Server V8.5.5, V8.5 and V8.0 should contain one copy of the MQ Resource Adapter file wmq.jmsra.rar, as well as an installedConnectors/wmq.jmsra.rar directory that contains the extracted contents of the MQ Resource Adapter. Any MQ classes found in the MQ HTTP Bridge web archive (WMQHTTP.war) can be ignored.


    WebSphere Application Server V7.0


    Each installation of WebSphere Application Server V7.0 should contain one copy of the MQ Resource Adapter file wmq.jmsra.rar, as well as an installedConnectors/wmq.jmsra.rar directory that contains the extracted contents of the MQ Resource Adapter. In addition, each profile contains an installedConnectors/wmq.jmsra.rar directory with MQ jar files. These profile-specific jars are not updated and should no longer be used from WebSphere Application Server V7.0.0.1 onward.


    WebSphere Application Server V6.1


    Each installation of WebSphere Application Server V6.1 should contain several MQ jar files in the top-level lib/WMQ/java/lib directory. In addition, the application server might use other MQ jars if the WebSphere variable MQ_INSTALL_ROOT has been set.




Sample output


    sh> ./mqjavalist.sh -r -f mqlist.txt -d /opt/IBM/WebSphere/AppServer
    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

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.


Additional Keywords:
troubleshoot troubleshooting trouble shoot classloader classpath configuration scripts

Download

    mqjavalist.shmqjavalist.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.

[{"Product":{"code":"SSFKSJ","label":"WebSphere MQ"},"Business Unit":{"code":"BU004","label":"Hybrid Cloud"},"Component":"Java","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"}],"Version":"8.0;7.5;7.1;7.0;6.0;5.3","Edition":"All Editions"}]

Document Information

Modified date:
15 June 2018

UID

swg21681142