Installing JBoss Messaging on JBoss AS 4.2.3

JBoss Messaging is the new enterprise messaging system for JBoss AS. According to JBoss it is a complete rewrite of JBossMQ and offers improved performance and features. Since I will be using messaging in an upcoming project and JBoss AS 4.2.3 comes with JBossMQ I decided to upgrade my Application Server from JBossMQ to JBoss Messaging. The installation instructions weren’t real clear and I ran into a few snags so I thought I would share.

Here is my environment:

WARNING: These instructions are for a non-clustered JBoss messaging installation using the automated installation and is only to be used on a default installation of JBoss AS. If you have made any changes to the AS configuration files you will need to follow the JBoss Messaging manual installation instructions found in the documentation. The installation won’t overwrite any files but you won’t be able to use the messaging along with your custom configuration unless you perform the manual installation.

  • Make sure you have the JBOSS_HOME (root directory of your JBoss AS installation) environment variable setup. If you don’t have this set correctly your installation will fail. For example my variable looks like the following: JBOSS_HOME = C:\jboss-4.2.3.GA
  • Unzip the JBoss Messaging into a directory of your choice.
  • Open a command prompt and navigate the “util” directory which is nside the JBoss Messaging directory.
  • Type ant -f release-admin.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
c:\jboss-messaging-1.4.4.GA>cd util
c:\jboss-messaging-1.4.4.GA\util>ant -f release-admin.xml
Buildfile: release-admin.xml
default:
validate-jboss:
prevent-messaging-overwrite:
validate-messaging-artifact:
create-server-config:
[echo] Creating JBoss Messaging configuration 'messaging' for C:\jboss-4.2.3.GA based on configuration 'default' with jboss-messaging.sar
[mkdir] Created dir: C:\jboss-4.2.3.GA\server\messaging
[copy] Copying 602 files to C:\jboss-4.2.3.GA\server\messaging
[copy] Copied 106 empty directories to 1 empty directory under C:\jboss-4.2.3.GA\server\messaging
expand-sar:
[unjar] Expanding: c:\jboss-messaging-1.4.4.GA\jboss-messaging.sar into C:\jboss-4.2.3.GA\server\messaging\deploy\jboss-messaging.sar
[copy] Copying 1 file to C:\jboss-4.2.3.GA\server\messaging\lib
[copy] Copying 2 files to C:\jboss-4.2.3.GA\server\messaging\conf\props
[copy] Copying 1 file to C:\jboss-4.2.3.GA\server\messaging\deploy
[copy] Copying 1 file to C:\jboss-4.2.3.GA\server\messaging\deploy
BUILD SUCCESSFUL
Total time: 17 seconds
c:\jboss-messaging-1.4.4.GA\util>

If the installation was successfull you should now have a directory called “messaging” in JBOSS_HOME/server.

screenhunter_04-2009-07-22

  • You now need to set the SuckerPassword attribute value in the messaging-service.xml which is located in JBOSS_HOME/server/messaging/deploy/jboss-messaging.sar. WARNING: It is a SECURITY RISK to not set this password. This password should only be exposed to administrators.

1
2
3
<!-- The password used by the message sucker connections to create connections.
THIS SHOULD ALWAYS BE CHANGED AT INSTALL TIME TO SECURE SYSTEM-->
<attribute name="SuckerPassword">Enter your password here</attribute>

  • JBoss Messaging 1.4.4 requires a specific version of jboss-remoting.jar. On JBoss 4.2+ you have to use Remoting 2.2.3. Replace the jboss-remoting.jar file located in JBOSS_HOME/server/messaging/lib with the 2.2.3 jar file you downloaded.  NOTE: I lost a couple of hours of my life yesterday because I forgot this step. JBoss messaging will startup fine without this jar but you will get connection errors when you try and run the examples.
  • Edit the JBOSS_HOME/server/messaging/conf/standardjboss.xml and set CreateJBossMQDestination to false on every occurance. This disables the proxies that try to create a destination on JBoss MQ if they can’t find it on JNDI.

1
<CreateJBossMQDestination>false</CreateJBossMQDestination>
  • Edit the JBOSS_HOME/server/messaging/conf/jboss-service.xml and comment out the reference to JBoss MQ on JSR-77 Management Bean.

1
2
3
4
5
6
<!-- ==================================================================== -->
<!-- JSR-77 Single JBoss Server Management Domain -->
<!-- ==================================================================== -->
<mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"
... Comment this line ...
<!-- <attribute name="JMSService">jboss.mq:service=DestinationManager</attribute> -->

  • Edit the JBOSS_HOME/server/messaging/conf/login-config.xml and comment out the jboss-mq security policies.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
### Comment these lines:
<!-- Security domain for JBossMQ -->
<!-- <application-policy name = "jbossmq">
<authentication>
<login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule"
flag = "required">
<module-option name = "unauthenticatedIdentity">guest</module-option>
<module-option name = "dsJndiName">java:/DefaultDS</module-option>
<module-option name = "principalsQuery">
SELECT PASSWD FROM JMS_USERS WHERE USERID=?</module-option>
<module-option name = "rolesQuery">
SELECT ROLEID, 'Roles' FROM JMS_ROLES WHERE USERID=?</module-option>
</login-module>
</authentication>
</application-policy> -->
<!-- Security domain for JBossMQ when using file-state-service.xml
<application-policy name = "jbossmq">
<authentication>
<login-module code = "org.jboss.mq.sm.file.DynamicLoginModule"
flag = "required">
<module-option name = "unauthenticatedIdentity">guest</module-option>
<module-option name = "sm.objectname">jboss.mq:service=StateManager</module-option>
</login-module>
</authentication>
</application-policy>
-->


The installation and configuration is complete. Now it is time to start the server and test it.

  • Start the JBoss server using the messaging configuration.

1
2
C:\Users\BrianA>cd %JBOSS_HOME%/bin
C:\jboss-4.2.3.GA\bin>run.bat -c messaging

  • Now it is time to test the installation. Get to a command prompt and go to directory where you exploded the JBoss Messaging software. Once there, go to the examples/queue directory. Simply type ant and the test will run. NOTE: Apache Ant has to be installed and in the path for this to work.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
c:\jboss-messaging-1.4.4.GA\examples\queue>ant
Buildfile: build.xml
identify:
     [echo] ###########################################################################
     [echo] #                       Running the QUEUE example                         #
     [echo] ###########################################################################
     [echo] The queue:      testQueue
     [echo] The client jar: ../..//jboss-messaging-client.jar
sanity-check:
init:
compile:
run:
     [java] Queue /queue/testQueue exists
     [java] The message was successfully sent to the testQueue queue
     [java] Received message: Hello!
     [java] The example connected to JBoss Messaging version 1.4.4.GA (1.4)
     [java]
     [java] #####################
     [java] ###    SUCCESS!   ###
     [java] #####################
BUILD SUCCESSFUL
Total time: 2 seconds


NOTE: Keep in mind the default installation uses the Hypersonic database for message persistence. This is fine for testing but is not suitable for a production environment. Before moving to production you will need to configure the Messaging instance to use a database such as Oracle, MySQL, PostgreSQL, etc… which is beyond the scope of this post.



Comments

  1. Kennedy Nakana November 9th

    Comment Arrow

    Thanks,

    I missed a very important step, replacing the jboss-remoting with version suggested. After replacing the jar file i did not have problems with my jboss-messaging, jbossesb installation on jboss as 4.3.2.GA.

    Thanks,
    Kennedy Nakana 😉


  2. Brian November 10th

    Comment Arrow

    Your welcome. Glad it helped someone.


  3. Sam June 22nd

    Comment Arrow

    Thanks for the help. It was very nice.


  4. Brian June 22nd

    Comment Arrow

    You are welcome Sam. Glad it helped.


  5. kumar July 17th

    Comment Arrow

    good article


  6. Brian July 17th

    Comment Arrow

    Thanks kumar. Glad you enjoyed it.


  7. sreenivasulu August 10th

    Comment Arrow

    Very good article. Thanks for sharing.


  8. Brian August 10th

    Comment Arrow

    You are welcome. I am glad it helped.


  9. sathish November 15th

    Comment Arrow

    Very nice steps. thanks Man


  10. Brian November 15th

    Comment Arrow

    Thanks sathish. Glad it helped.


  11. Suresh November 16th

    Comment Arrow

    Hi Brian,We are using JBoss 4.2.3 GA and JBoss Messaging 1.4.5 GA and we have configured the same as explained by you.Shall we use the same jboss-remoting2.2.3.jar file,otherwise any alternative jars can be used.

    Thanks in advance.


  12. Brian November 17th

    Comment Arrow

    Suresh – I would give the remoting2.2.3 a try. If it doesn’t work you may have to use a new version of it but I am guessing it will work fine.


  13. Suresh November 22nd

    Comment Arrow

    Hi Brian Thanks for giving valuable advice,we are able to run the examples successfully and we are not able to run the programs using Eclipse IDE,Could you give any idea how we can run the programs using Eclipse.we are getting the exception saying some properties need to be passed while running the application.

    Thanks in Advance.


  14. Suresh November 22nd

    Comment Arrow

    Hi Brian Thanks for giving valuable advice,we are able to run the examples successfully and we are not able to run the programs using Eclipse IDE,Could you give any idea how we can run the programs using Eclipse.we are getting the exception saying some properties need to be passed while running the application.


  15. Suresh November 28th

    Comment Arrow

    Hi Brian, while deploying the application to jboss server I am getting the following exception ” java.lang.ClassCastException:
    org.jboss.jms.client.JBossConnectionFactory cannot be cast to
    javax.jms.ConnectionFactory ” in the QueueExample,i think this problem with jar files or you have any idea pls give me response asap. I got stuck up on this issue since last 5 days…………
    Thank you Brian in advance….


  16. Suresh November 28th

    Comment Arrow

    Hi Brian, while deploying the application to jboss server I am getting the following exception ” java.lang.ClassCastException:
    org.jboss.jms.client.JBossConnectionFactory cannot be cast to
    javax.jms.ConnectionFactory ” in the QueueExample,i think this problem with jar files or you have any idea pls give me response asap. I got stuck up on this issue since last 5 days…………
    Thanks Brian in advance….


  17. Kumar November 28th

    Comment Arrow

    Hi Suresh, Are you using JMS related jar file i.e jms.jar in your application lib?


  18. Suresh November 29th

    Comment Arrow

    Hi Kumar,I am using jms.jar, eventhough i am getting the same exception.
    Thanks in advance Kumar.


  19. Kumar November 29th

    Comment Arrow

    Suresh,Could you please check version of jms.jar which is compatible with JBoss Messaging 4.2.3 or not.


  20. Brian November 29th

    Comment Arrow

    My advice would be to try a quick test using the exact versions that I used in the post above. If that works then you know you have an issue with the versions you are using.


  21. Brian December 11th

    Comment Arrow

    You are welcome. Glad it helped.


  22. venkat June 5th

    Comment Arrow

    HI Brain,

    Nice article.

    Thanks,
    Venkat


  23. Brian June 7th

    Comment Arrow

    Glad it helped you venkat.


  24. venkat June 24th

    Comment Arrow

    Hi Brian,

    Could you please provide me sample example how to configure jms configurations in jboss 4.2.3 GA and sender and receiver java code.
    I am not able to download the link you provided on above Jboss Messaging 1.4.4


Add Yours

  • Author Avatar

    YOU


Comment Arrow




About Author

Brian

Brian Abston is a Java Developer in Oklahoma who also loves technology.