Installing and testing the resource adapter in GlassFish Server

This task describes the steps needed to install the IBM® MQ resource adapter, and run the installation verification test (IVT) application in GlassFish Server on a Windows operating system.

About this task

These instructions are for GlassFish Server version 4.

This task assumes that you have a running GlassFish Server application server, and that you are familiar with standard administration tasks for it. This task also assumes that you have an IBM MQ installation on your local system and that you are familiar with standard administration tasks.

Note: In order to complete the task steps described in this topic, you must have a functioning IBM MQ installation, with the following objects configured:
  • Create a queue manager called QM, that is started on port 1414, that uses channel SYSTEM.DEF.SVRCONN, and that connects using Client transport. You also need to create a queue called Q1.

Procedure

  1. Start the GlassFish Server asadmin shell program.
    1. Open the Windows command line and navigate to the < GlassFish >/bin directory, where < GlassFish > is the directory where GlassFish Server version 4 is installed.
    2. Enter the command asadmin in the command line.
      The asadmin command will open a shell program in the command line that enables you to create a new domain.
    GlassFish Server version 4 is installed on your system.
  2. Create, and then start a domain.
    1. Use the create-domain command, specifying the port and domain name, to create a new domain. Enter the following command into the command line:
      
      create-domain --adminport < port > < domain name >
      
      where < port > is the port number, and < domain name > is the name you want the domain to use.
      Note: The create-domain command has many optional parameters associated with it. During this task, we will be using only the --adminport parameter. For more information see the product documentation for GlassFish Server version 4.

      If the port you specified is in use, you will receive the message Port for < domain_name > < port > is in use.

      If the domain name you specified is in use, you receive a message telling you that your specified name is already in use, as well as a list of all domain names that are currently unavailable.

    2. When prompted to input a user name and password, enter the credentials to be used to log on to the application server through a web browser.
      If the command completes successfully, a message summarizing the domain creation is displayed on the command line, including the message Command create-domain executed successfully.

      You have successfully created a domain.

    3. Start your domain by entering the following command into the command line:
      
      start-domain < domain name >
      
      where < domain name > is the domain name you previously specified.
  3. Use a web browser to access GlassFish application server.
    1. In the address bar of a web browser enter the following command:
      
      localhost:< port >
      
      where < port > is the port that you specified earlier when creating your domain.
      The GlassFish Console is displayed.
    2. When the GlassFish Console has loaded, and you are prompted for a user name and password, enter the credentials that you specified in step 2b.
  4. Upload the resource adapter to GlassFish Server 4.
    1. On the tool bar Common Tasks select the Applications menu item to display the Applications page.
    2. Click the Deploy button, to open the Deploy Applications or Modules page.
    3. Click the Browse button to and then navigate to the location of the wmq.jmsra.rar file. Select the file and click OK.
  5. Create a connection pool.
    1. On the tool bar, under Resources, select the Connectors menu item.
    2. Then select Connector Connection Pools menu item, to open the Connector Connection Pools page.
    3. Click the New button to open the New Connector Connection Pool (Step 1 of 2) page.
    4. On New Connector Connection Pool (Step 1 of 2) page, input the pool name as jms/ivt/IVTCF-Connection-Pool into the Pool Name field.
    5. In the Resource Adapter field select wmq.jmsra.
    6. In the Connection Definition field enter javax.jms.ConnectionFactory.
    7. Select Next, then select Finish.
  6. Create the connector resources.
    1. On the tool bar, under the Connectors menu, select the Connector Resource option, to open the Connector Resources page.
    2. Select New, to open the New Connector Resource page.
    3. In the JNDI Name field, enter IVTCF.
    4. In the Pool Name field, enter jms/ivt/IVTCF-Connection-Pool.
    5. Leave all other fields empty.
    6. For each of the following property/value pairs, press the Add Property button, and enter the property name, and the value as shown in the following example:
      • name: host; value: localhost
      • name: port; value 1414
      • name: channel; value: SYSTEM.DEF.SVRCONN
      • name: queueManager; value: QM
      • name: transportType; value: CLIENT
      Note: Make sure that you use the correct values for your own configuration settings, which might be different from the ones shown in this example.
    7. In the tool bar, under Connectors, select the Admin Object Resources menu item, to open the Admin Object Resources page.
    8. In the Admin Object Resources page, click New to open the New Admin Object Resource page.
    9. In the JNDI Name field enter IVTQueue.
    10. In the Resource Adapter field enter wmq.jmsra.
    11. In the Resource Type field enter javax.jms.Queue.
    12. Leave the Class Name field as it is.
    13. For each of the following property/value pairs, press the Add Property button, and enter the property name, and the value as shown in the following example:
      • name: name; value: IVTQueue
      • name: baseQueueManagerName; value QM
      • name: baseQueueName; value: Q1
      Note: Make sure that you use the correct values for your own configuration settings, which might be different from the ones shown in this example.
    14. Click the OK button.
    15. Select the Enabled checkbox, then click the Enable button.
  7. Deploy the EAR file wmq.jmsra.ivt.ear into GlassFish Server.
    1. Click the Applications option in the tool bar to display the Applications page.
    2. Click Deploy to add the IVT application.
    3. In the Location field navigate to, and select, the wmq.jmsra.ivt.ear.
    4. In the Virtual Servers field, select server, and then click OK.
  8. Launch the IVT program.
    1. Click the Applications option in the tool bar to display the Applications page.
    2. Click on the wmq.jmsra.ivt in the Deployed Applications table.
    3. Click the Launch button, in the Modules and Components table.
    4. Select the http: link.
    5. Click Run IVT.
    You have launched the IVT program, and if you are successful, the following output is displayed:
    Figure 1. Successful IVT output
    Image showing successful IVT output.