+

Search Tips | Advanced Search

Installing and testing the resource adapter in GlassFish Server

To install the IBM MQ resource adapter in GlassFish Server on a Windows operating system, we must first create and start a domain. We can then deploy and configure the resource adapter, and deploy and run the installation verification test (IVT) application.


About this task

Important: These instructions are for GlassFish Server version 4.

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

Note: In order to complete the following task steps, we must have a functioning IBM MQ installation, with the following objects configured:

  • A queue manager called QM, that is started on port 1414, that uses channel SYSTEM.DEF.SVRCONN, and that connects using Client transport.
  • 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 opens a shell program in the command line that enables you to create a new domain.

    GlassFish Server version 4 is started on the 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 on the command line:
      create-domain --adminport port domain_name
      
      where port is the port number, and domain_name is the name we want the domain to use. Note: The create-domain command has many optional parameters associated with it. However, for this task we need the --adminport parameter only. For more information, see the product documentation for GlassFish Server version 4. If the port that you specified is in use, the following message appears:
      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.

      We 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 we 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 toolbar 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 toolbar, under Resources, select the Connectors menu item.
    2. Then select Connector Connection Pools menu item, to open the Connector Connection Pools page.
    3. Click New 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 toolbar, 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, click Add Property, 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 we use the correct values for the own configuration settings, which might be different from the ones shown in this example.

    7. In the toolbar, 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, click Add Property, 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 we use the correct values for the own configuration settings, which might be different from the ones shown in this example.

    14. Click OK.
    15. Select the Enabled checkbox, then click Enable.

  7. Deploy the EAR file wmq.jmsra.ivt.ear into GlassFish Server.
    1. Click the Applications option in the toolbar 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 toolbar to display the Applications page.
    2. Click on 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.

    We have launched the IVT program, and if we are successful, the following output is displayed:

    Figure 1. Successful IVT output

Parent topic: Use the IBM MQ resource adapter

Last updated: 2020-10-04