Tuesday, April 15, 2008

Configuring JMS with JBOSS 4.0.2

The following documents illustrate steps to configure Jboss with JMS

1) Installing Jboss messaging with Jboss 4.0.2

a. Get the Jboss messaging software from http://www.jboss.org/jbossmessaging/downloads/


b. Set up JBOSS_HOME and ANT_HOME

c. Unzip the messaging software to local directory

d. Open Command Prompt

e. Go to util directory( cd util)

f. execute the command ant -f release-admin.xml, The installation script will create a $JBOSS_HOME/server/messaging configuration

g. Create a new Jboss Server instance in Eclipse using this configuration

h. Example, Name:EJB_Jboss_JMS

i. Jboss Home::C:\DevWorld\SDE\jboss-4.0.2

j. Server Configuration: messaging

k. Start the Server from Eclipse

l. The default installation comes with the following pre configured destinations defined in (destination-service.xml) testTopic, securedTopic, testDurableTopic, testQueue, A,B,C etc.

m. Test the installation by running supplied examples with default configurations


Execute the following command from the console.



>> cd .../examples/queue

>> $ant



A successful configuration will output something similar to,



Buildfile: build.xml

identify:

[echo] Running the queue example

[echo] The queue: testQueue

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.0.0(1.0)

[java] #####################

[java] ### SUCCESS! ###

[java] #####################



n) Configure the Persistence for Messages


The configuration of "persistent" services is grouped in a xxx-persistence-service.xml file, where the actual file prefix is usually inferred from its corresponding database JDBC connection string. By default, Messaging ships with a hsqldb-persistence-service.xml, which configures the Messaging server to use the in-VM Hypersonic database instance that comes by default with any JBossAS instance.


To Use MSSQL as the Database for persistence, copy the file mssql-persistence-service.xml form ..examples\config and place it in to $JBOSS_HOME \server\messaging\deploy\jboss-messaging.sar

Change the occurance of Datasource name “DefaultDS” with the actual datasource name defined in respective *-ds.xml file(datasource file)

This will make the messaging server to use MSSQL database rather then HSQL database.

Delete the hsqldb-persistence-service.xml file form $JBOSS_HOME \server\messaging\deploy\jboss-messaging.sar


o) To deploy extra destinations,

To deploy a new destination, create a new deployment descriptor named myqueue-service.xml (or anything else that ends in -service.xml) and copy it to the JBoss instance deployment directory $JBOSS_HOME/server/messaging/deploy.

An example of a scoped destination deployment descriptor is listed below:


It will create a new queue named MyNewQueue1, and it can be lookup from. Java Classes using the following string “/queue/ MyNewQueue1”

You can View the JNDI Tree by doing the following,


p) Viewing JNDI Tree In JBOSS

goto http://localhost:8080/jmx-console

- click on “service=JNDIView” link under the “jboss” section

- click on the button under “java.lang.String list()” …

We can loop back to step 1-m to test the installation.

1 comment :

  1. how to configure Eclipse 3.x for jboss 4.x ?

    I created the appClientModule and eclipse says

    "selection does not contain anything to run on server! "

    ReplyDelete