Setting up the JNDI

You must set up the JNDI environment before you can run the JMSHeader node sample. The necessary queues are created automatically by the sample. Complete the following steps to create the JNDI objects that are required to run the JMS Coordinated Request-Reply sample. Use the jms.defs file that is provided in the sample.

On Windows

Run the JNDI setup after importing, or importing and deploying the sample but before running the sample flow:

  1. Open the mq_install_path\Java\bin\JMSAdmin.config file, where mq_install_path should be replaced with the actual WebSphere MQ install location. In the JMSAdmin.config file ensure that the following name-value pairs are defined:
    INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
    PROVIDER_URL=file:/C:/JNDI-Directory
  2. Under C:\, create a folder named JNDI-Directory.
  3. Ensure that the jms.defs file that is provided with the sample contains the correct queue manager name and port number.
    1. In the Application Development view, expand the JMS Header Node integration project.
    2. Open the Other Resources directory and double-click jms.defs to open the file for editing.
    3. If you are using the default queue manager and port, QMANAGER must have a value of IB9NODE and PORT must have a value of 2414. If you are using a different queue manager or port, edit the values for QMANAGER or PORT and save your changes.
  4. Run the following command, where:
    mq_install_path\Java\bin\JMSAdmin < "toolkit_workspace_path\JMSHeader Node Message Flows\jms.defs"
    Note: On Windows you will need to enclose the command in quotes if there are spaces in the paths, as shown in the example above.
  5. If any error messages are returned on the command line during the creation of the JNDI objects in the .bindings file, delete the .bindings file from the C:\JNDI-Directory and run the previous command again.

On UNIX

Run the JNDI setup before deploying the sample flow:

  1. Open the mq_install_path/java/bin/JMSAdmin.config file, where mq_install_path should be replaced with the actual WebSphere MQ install location. In the JMSAdmin.config file ensure that the following name-value pairs are defined:
    INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
    PROVIDER_URL=file:/home/username/JNDI-Directory
  2. Under /home/username, create a folder named JNDI-Directory.
  3. Ensure that the jms.defs file that is provided with the sample contains the correct queue manager name and port number.
    1. In the Application Development view, expand the JMS Header Node Message Flows project.
    2. Open the Other Resources directory and double-click jms.defs to open the file for editing.
    3. If you are using the default queue manager and port, QMANAGER must have a value of IB9QMGR and PORT must have a value of 2414. If you are using a different queue manager or port, edit the values for QMANAGER or PORT and save your changes.
  4. Run the following command, where:
     cd mq_install_path/java/bin
     . ./setjmsenv
    Running the setjmsenv command sets up the JMS environment and adds com.ibm.mqjms.jar to the CLASSPATH. Java is required by JMSAdmin and if it is not already set in your PATH it can be added with the following command, where JAVA_HOME is the install location of Java:
    export PATH=$PATH:JAVA_HOME/bin
    ./JMSAdmin < toolkit_workspace_path/"JMSHeader Node Message Flows"/jms.defs
    Note: On Unix you will need to enclose the command in quotation marks (") around the project folder name because it has spaces, as shown above.
  5. If any errors occur during the creation of the JNDI objects in the .bindings file, delete the .bindings file from the /home/username/JNDI-Directory and run the previous command again. Ensure that JAVA_HOME/bin has been added to your PATH, where JAVA_HOME is the install location of Java.
  6. A sample broker archive (BAR) file (JMSCoordinatedRequestReplyUnix.bar) is provided with the sample, where the user name is db2admin.

On z/OS

Run the JNDI setup before deploying the sample flow:

  1. Open the mq_install_path/Java/bin/JMSAdmin.config file, where mq_install_path should be replaced with the actual WebSphere MQ install location. In the JMSAdmin.config file ensure that the following name-value pairs are defined:
    INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
    PROVIDER_URL=file:/home/username/JNDI-Directory
  2. Under /home/username, create a folder named JNDI-Directory.
  3. Copy the jms.defs file that is provided with the sample into the /home/username directory.
  4. Ensure that the jms.defs file that is provided with the sample contains the correct queue manager name and port number.
  5. Run the following command, where mq_install_path should be replaced with the actual install location of WebSphere MQ:
    mq_install_path/Java/bin/JMSAdmin < /home/username/jms_zOS.defs
  6. In the jms_zOS.defs file, ensure that the transport type is named BINDINGS for z/OS.
  7. If any errors occur during the creation of the JNDI objects in the .bindings file, delete the .bindings file from the /home/username/JNDI-Directory and run the previous command again.
  8. A sample broker archive (BAR) file (JMSCoordinatedRequestReplyUnix.bar) is provided with the sample, where the user name is db2admin.

Back to Running the JMSHeader node sample

Back to sample home