Chapter 4. Installation

As of today, JBoss Messaging is conflicting with the existing JBoss MQ server that ships with the JBoss 4.x and 5.x distributions. Therefore the provider is packaged as a scoped Service ARchive (.sar).

4.1. Installing JBoss Messaging with JBossAS 4.x

4.1.1. JBossAS 4.x Messaging installation - Automated procedure

Set up the JBOSS_HOME environment variable to point towards the JBoss 4.x installation you want to use JBoss Messaging with. Run the installation script, available in the util directory of the release bundle. Note that you need Apache Ant 1.6.x installed and accessible from your current directory.

    cd util
    ant -f create-messaging-config.xml
		

The installation script will create a $JBOSS_HOME/server/messaging configuration.

4.1.2. JBossAS 4.x Messaging installation - Alternative manual procedure

4.1.2.1. Creating the server configuration

We need to create a server configuration based on the default folder

    cd $JBOSS_HOME/server
    cp -r default messaging
			

Note: The "all" configuration can be also used as a template. If you choose to base your configuration on "all", you will need to adjust the steps 4.1, 4.2 and 4.3 accordingly, given the fact that in a clustered configuration, JBossMQ is deployed as a HASingleton under server/all/deploy-hasingleton/jms.

4.1.2.2. Configuring the JMS Resource adapter

In jms-ds.xml, JBoss Messaging defines a connection factory bound by the JMS Resource adapter at “java:/JmsXA”. Before we remove the whole jms folder (see 1.2.4) we need to move jms-rar.ar to /deploy

    cd $JBOSS_HOME/server/messaging/deploy/jms
    cp jms-ra.rar ..
		   

4.1.2.3. Removing JBossMQ

As aforementioned, JBossMQ should be taken out of the distribution.

    cd $JBOSS_HOME/server/messaging/deploy
    rm -r jms
		   

4.1.2.4. Configuring the security domain

Modify $JBOSS_HOME/server/messaging/conf/login-config.xml security configuration file and add <module-option name="unauthenticatedIdentity">guest</module-option> to the configuration of the UsersRolesLoginModule that is part of the JAAS stack of the "other" security domain. The correct configuration of the "other" security domain should be similar to:

			
<application-policy name = "other">
  <authentication>
     <login-module code = "org.jboss.security.auth.spi.UsersRolesLoginModule" flag = "required">
       <module-option name="unauthenticatedIdentity">guest</module-option>
     </login-module>
   </authentication>
</application-policy>
			
		   

4.1.2.5. Deploying the service archive

You are now ready to deploy the provider. Please copy jboss-messaging-scoped.sar service archive to the messaging configuration's deployment directory.

    cp jboss-messaging-scoped.sar $JBOSS_HOME/server/messaging/deploy
		   

4.2. Starting the server

To run the server, move to the JBOSS_DIST/bin directory and execute the run.bat or run.sh script as appropriate for your operating system.

     cd $JBOSS_HOME/bin
     ./run.sh -c messaging
   

A successful JBoss Messaging deployment generates logging output similar to:

	....
13:56:46,155 WARN  [JDBCPersistenceManager]

Warning! Connection transaction isolation should be READ_COMMITTED, but it is currently NONE.
         Using an isolation level less strict than READ_COMMITTED may lead to data consistency problems.
         Using an isolation level more strict than READ_COMMITTED may lead to deadlock.

13:56:46,165 INFO  [JDBCPersistenceManager] Removing all non-reliable message references
13:56:46,175 INFO  [JDBCPersistenceManager] Updating all reliable references to not loaded
13:56:47,006 INFO  [ServerPeer] JMS ServerPeer [server.0] started, connection failure checking active, lease period 20000 ms
13:56:47,006 INFO  [ConnectionFactory] [/ConnectionFactory, /XAConnectionFactory, java:/ConnectionFactory, java:/XAConnectionFactory] deploy
ed
13:56:47,026 INFO  [Topic] Topic[/topic/testTopic] started, fullSize=75000, pageSize=2000, downCacheSize=1000
13:56:47,026 INFO  [Topic] Topic[/topic/securedTopic] started, fullSize=75000, pageSize=2000, downCacheSize=1000
13:56:47,026 INFO  [Topic] Topic[/topic/testDurableTopic] started, fullSize=75000, pageSize=2000, downCacheSize=1000
13:56:47,046 INFO  [Queue] Queue[/queue/testQueue] started, fullSize=75000, pageSize=2000, downCacheSize=1000
13:56:47,056 INFO  [Queue] Queue[/queue/DLQ] started, fullSize=75000, pageSize=2000, downCacheSize=1000
13:56:47,056 INFO  [Queue] Queue[/queue/A] started, fullSize=75000, pageSize=2000, downCacheSize=1000
13:56:47,056 INFO  [Queue] Queue[/queue/B] started, fullSize=75000, pageSize=2000, downCacheSize=1000
13:56:47,066 INFO  [Queue] Queue[/queue/C] started, fullSize=75000, pageSize=2000, downCacheSize=1000
13:56:47,066 INFO  [Queue] Queue[/queue/D] started, fullSize=75000, pageSize=2000, downCacheSize=1000
13:56:47,066 INFO  [Queue] Queue[/queue/ex] started, fullSize=75000, pageSize=2000, downCacheSize=1000
13:56:47,076 INFO  [Topic] Topic[/topic/openTopic] started, fullSize=75000, pageSize=2000, downCacheSize=1000
	....
   

Note: "Warning! Connection transaction isolation should be READ_COMMITTED, but it is currently NONE."

By default JBossAS is shipped with HyperSonic, an in-memory Java-based database engine. Via the default datasource, HSQL is used by Messaging for persistence, caching, etc...

The following wiki page Critique of Hypersonic outlines some of the well-known issues occuring when using this database.

During development and before going in production, you must use an enterprise-class database backend such as MySQL, Oracle or PostgreSQL. See Section 5.4 for details about replacing HSQL.

4.3. Validation

To validate the installation procedure, we will be running a basic example which send a persistent JMS message to a queue called queue/testQueue.

Open an new command line. Set the JBOSS_HOME environment variable to point at a JBossAS 4.x installation. Navigate to the folder where you exploded the main archive and drill down to /examples/queue. You need to use Apache Ant to execute the build.xml file

$ant

Buildfile: build.xml
identify:
  [echo] Running the queue example
  [echo] The queue: testQueue
sanity-check:
init:
compile:
run:
  [java] Queue /queue/testQueue exists
  [java] 14:34:11,884 INFO  @main [FieldsManager] FieldsManager in use = org.jboss.serial.classmetamodel.UnsafeFieldsManager
  [java] The message was successfully sent to the testQueue queue
  [java] Received message: Hello!
  [java] The example connected to JBoss Messaging version 1.0.0 (1.0)
 [java] #####################
  [java] ###    SUCCESS!   ###
  [java] #####################