Recently we migrated a large portion of my employers applications from Weblogic 8 to JBoss 4. During this process we had to re-write some of the clients that are using JMS to send messages to our application.
Since the clients are mostly running Weblogic it was not an issue before, but with our JBoss servers running behind a firewall it was not a straight-forward operation to just add some client jars and change the endpoints.
This blog entry is a reminder for me what needs to be done to be able to access a JBoss JMS through a firewall.
First, let's take a look at the client libraries that are necessary to run a JBoss JMS client.
The naive approach was to pick the jbossall-client.jar from the client folder of the JBoss installation - but that will not work (allthough the name suggests it right? :))
I ended up with the following jars for my test client (pure Java application):
* jbossall-client.jar
* jboss-common-client.jar
* jboss-messaging-client.jar
* javassist.jar
* jboss-aop-jdk50.jar (from the server/default/deploy/jboss-aop-jdk50.deployer folder!)
* trove.jar (from the server/default/deploy/jboss-aop-jdk50.deployer folder!)
* log4j.jar
Of course the jbossall-client must NOT be used when running from another applicationserver since it contains (for example) most of the javax.* interfaces in JDK1.4 version (for JBoss 4). So for the application running in the Weblogic the final list looked like:
* concurrent.jar
* javassist.jar
* jboss-aop-jdk50.jar (from the server/default/deploy/jboss-aop-jdk50.deployer folder!)
* jboss-common-client.jar
* jboss-messaging-client.jar
* jboss-remoting.jar
* jnp-client.jar
* trove.jar (from the server/default/deploy/jboss-aop-jdk50.deployer folder!)
Now on to the actual JBoss configuration. Since JBoss uses 2 different ports for JNDI, one for lookup and one for RMI we had to open two ports in the firewall.
Relevant attributes in conf/jboss-service.xml are Port and RmiPort.
Now we could successfully list and retreive the objects in the JBoss JNDI. When we tried to create a Connection from the ConnectionFactory we got stuck in the firewall once more. After looking in the firewall logs we realized that the JBoss server opened "random" ports back to the client for communication, which obviously won't work through a firewall.
The server/default/deploy/jboss-messaging.sar/remoting-bisocket-service.xml contains the configuration for this feature, and the ports must be specified otherwise JBoss will use "random" ports. The relevant attributes are serverBindPort and secondaryBindPort.
Setting the ports in the configuration file as well as using the correct jars solved our problems.