CloverDX Blog on Data Integration

How To Connect to JMS Queue on Glassfish V2 with CloverDX

Written by Agata Vackova | December 06, 2010

You can connect to any JMS broker from CloverDX using JMSReader or JMSWriter component. In this article you can find instruction, how to create JMS Connection and how to configure the graph to connect to JMS queue on Glassfish application server from CloverDX.

What is JMS Queue?

JMS (Java Message Service) is a Java Enterprise Edition (EE) technology used to allow messages to be sent in a decentralized manner between web clients or end-users. In order to check for new messages or to send outgoing ones, a Java program must successfully connect to the JMS queue in order to proceed with the application.

Let's suppose we've defined JMS connection factory test on the Glassfish application server as follows and JMS queue jms/testQueue:

Now we need to define JMS connection in CloverDX graph:

"Connection factory JNDI name" and "Destination JNDI" refers to the objects we have just created on our application server.

Library appserv_rt.jar contains com.sun.enterprise.naming.SerialInitContextFactory class. When you add the library to the connection settings, you can choose the factory class from the combo box. But when you know the class name, you don't need to do it, as the Glassfish server has this library on the class-path or you will add it to the project class-path (see below). Remove the library after connection edition; having it in connection definition and in the class-path can lead to unpredictable errors.

If the graph is running on CloverDX Server within the same Glassfish server instance, you don't need any further settings as all needed jar files are contained in application server.

When you run the graph as a "client" (from CloverDX Designer, command line or other CloverDX Server) you need to set following jars on the jvm class path:

  • /lib/appserv-rt.jar
  • /lib/appserv-admin.jar
  • /lib/javaee.jar
  • /lib/j2ee.jar
  • /imq/lib/imqjmsra.jar

(You find them in your Glassfish home directory).

In CloverDX Designer you can do it by selecting the project. After right click go to Properties --> Java Build Path:

You can add the libraries with "Add JARs..." button if you have copied the files to the Workspace or with "Add External JARs..." if the files are outside the Workspace.

You also need to set the -Dorg.omg.CORBA.ORBInitialHost property if you run the graph on the different host and the naming service port property, if necessary. The default naming service port in the app server is 3700. If the naming service is running on a different port, you'll need to set it via the -Dorg.omg.CORBA.ORBInitialPort property. You can double-check the actual naming service port for a given server instance by looking in the server instace's domain.xml for "orb-listener-1". Alternatively, check the Configuration --> ORB --> IIOP Listeners --> orb-listener-1 in Glassfish Administration Console.

To set these properties, when running the graph from CloverDX Designer, you need to create new graph launch configuration:

  1. Go to Run --> Run Configurations
  2. Create new CloverDX graph configuration
  3. Switch to Arguments tab and set the properties: