How to use JMSAdmin to configure JMS resources for use with WebSphere® Application Server V4.0 releases
 Technote (FAQ)
 
Problem
If a WebSphere V4.0 application needs to send messages to a queue or topic defined in WebSphere MQ 5.2 or 5.3, the JMS resources, such as queue or topic connection factories and destinations are defined using the MQ JMSAdmin tool. The JMS resources are bound to the WebSphere Application Server Java Naming and Directory Interface™ (JNDI) namespace when they are defined in JMSAdmin.

This technote describes how to configure the JMSAdmin tool to work properly with the WebSphere 4.0 namespace.
 
Solution
The JMSAdmin tool is installed in the MQ_HOME/Java/bin directory. The JMSAdmin.config file is located in this directory and must be modified to connect to the WebSphere Application Server V4.0 namespace. Follow the steps below to make the necessary modifications:
  1. Open JMSAdmin.config and configure the INITIAL_CONTEXT_FACTORY as follows:

    #INITIAL_CONTEXT_FACTORY=com.sun.jndi.ldap.LdapCtxFactory
    #INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
    INITIAL_CONTEXT_FACTORY=com.ibm.ejs.ns.jndi.CNInitialContextFactory
    #INITIAL_CONTEXT_FACTORY=com.ibm.websphere.naming.WsnInitialContextFactory

    Ensure that the line containing com.ibm.ejs.ns.jndi.CNInitialContextFactory is uncommented (no # at the beginning of the line) and the other lines are commented out as shown above. It is important not to use the com.ibm.websphere.naming.WsnInitialContextFactory class because it does not work properly with JMSAdmin.

  2. Configure the PROVIDER_URL as follows:

    #PROVIDER_URL=ldap://polaris/o=ibm,c=us
    #PROVIDER_URL=file:/C:/JNDI-Directory
    PROVIDER_URL=iiop://localhost:900/

    Ensure that the first two PROVIDER_URL entries are commented out.

    The actual host name must be used if WebSphere Application Server is installed on a host that is remote to JMSAdmin. Port 900 is the default bootstrap port for V4.0 releases. It is possible to specify a different bootstrap port. To do so, edit the admin.config file in $WAS_HOME/bin.

    Add this line to the file:

    com.ibm.ejs.sm.adminServer.bootstrapPort=xxx
    where xxx is the port number

    If a bootstrap port other than 900 is being used, specify that port in the PROVIDER_URL of JMSAdmin.config.

  3. Add the following files to the classpath after editing the JMSAdmin.config file and before running the JMSAdmin tool:
  • com.ibm.mq.jar - located in the $MQ_HOME/Java/lib
  • com.ibm.mqjms.jar - located in the $MQ_HOME/Java/lib
  • jms.jar - located in the $MQ_HOME/Java/lib
  • ns.jar - located in the $WSAS_HOME/lib

On Windows® platforms, create a .bat file with the following text to set the classpath before running JMSAdmin:
@echo off

set MQ_JAVA_INSTALL_PATH=C:\Program Files\IBM\WebSphere MQ\Java

@rem Java runtime
set JAVA_HOME=C:\WebSphere\AppServer40\java\bin

@rem MQ JMS
set MQ=%MQ%;%MQ_JAVA_INSTALL_PATH%\lib
set MQ=%MQ%;%MQ_JAVA_INSTALL_PATH%\lib\com.ibm.mq.jar
set MQ=%MQ%;%MQ_JAVA_INSTALL_PATH%\lib\com.ibm.mqjms.jar
set MQ=%MQ%;%MQ_JAVA_INSTALL_PATH%\lib\jms.jar

@rem needed to use WebSphere name service for JNDI
set WebSphereCP=C:\WebSphere\AppServer40\lib\ns.jar

set CLASSPATH=%MQ%;%WebSphereCP%;%CLASSPATH%
set PATH=%JAVA_HOME%;%MQ_JAVA_INSTALL_PATH%\lib;%PATH%;

If you are running JMSAdmin on a platform other than Windows, manually add the .jar files to the classpath or create a .sh file to do this.

After the classpath is set correctly, you can run the JMSAdmin tool. Run JMSAdmin.bat (Windows) or JMSAdmin.sh (Unix®). When it starts correctly, you see the following output:




If you have a problem starting JMSAdmin, it is useful to get a JMSAdmin trace. To do so, run

JMSAdmin.bat -t -v ( Windows)
or
./JMSAdmin.sh -t -v (Unix).

The trace provides more detail about what causes the JMSAdmin startup to fail.

After JMSAdmin starts, it is used to create JMS resources for use with WebSphere Application Server. For details on how to create JMS resources using JMSAdmin, see the WebSphere MQ Using Java manual, available at:
http://publibfp.boulder.ibm.com/epubs/pdf/csqzaw12.pdf

 
 
Cross Reference information
Segment Product Component Platform Version Edition
Business Integration WebSphere MQ Java Multi-Platform 5.2, 5.3 Edition Independent
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Java Message Service (JMS)
Operating system(s): HP-UX
Software version: 4.0.7
Software edition:
Reference #: 1162744
IBM Group: Software Group
Modified date: Mar 9, 2004