Skip to main content

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.

Comments

  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

Post a Comment

Popular posts from this blog

Converting Java Map to String

Java Collections framework, String manipulation etc is something that we often encounter in Development process.
For processing collections (like checking null/empty, Intersection, Disjunction) We do have some of the very use full libraries.

Some of the Collection related libraries are Apche Commons Collections and Google  Collections(Guava).

Problem Use Case

This article explains how to convert a Java Map to String(and vice versa) using different libraries and technique.

One way is to use StringBuilder(Or String) and loop though the Map and build the String by applying some sort of separator ( for key:value and entry). Here we have to take care of the null value etc.

Without Any Library
If we want to convert the map to a String with key value separator and also individual entry seperator in the resulting String, we have to write code for that. For a simple Map, we have to iterate though the map, take care of the null values etc. Following is a sample to get String built out from Map C…

Masking Credit Card number in Java

Sometimes we need to mask crucial information like Credit Card Numbers, CVV numbers etc before storing  or logging the information. This example mask Credit Card Number (Except last 4 Digit) from a Text which contains information along with Credit Card Number.

The following example demonstrates how we can easily mask the credit card with Matcher and Pattern Classes. This Sample Code uses Matcher and Pattern.
Pattern Used in this sample is not optimized for Credit Card Numbers, this pattern will get any numerical numbers in the String Content.  Based on the Credit Card Type a more efficient and Strict RegEx can be used to mask the Credit Card.
/**Mask the Credit card number but last four digit value **/   Pattern PATTERN = Pattern.compile("[0-9]+"); String message = content; Matcher matcher = PATTERN.matcher(message); String maskingChar = "*"; StringBuilder finalMask = new StringBuilder(maskingChar); while …

Invoking EJB deployed on a remote machine

Invoking EJB deployed on a remote machineIn case we are calling remote ejb( ejb deployed on remote machines),The JNDI lookup might lookup like,Properties env = new Properties();env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");env.put(Context.PROVIDER_URL, "XX.XXX.XX.XX:1099");env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); Context ctx = new InitialContext(env);If we are calling local ejb then we can simply create InitialContext without any parameters.Like,Context ctx = new InitialContext();