First step is to add messaging configuration to the JBoss configuration xml. In this case I will use the standalone configuration.
Open standalone.xml located at jboss-as-7.1.1.Final\
Add org.jboss.as.messaging to the extensions
Add the HornetQ messaging configuration, make sure it is the first xml entry after profile.
netty
jms
We will use
RemoteConnectionFactory as JMS ConnectionFactory with "java:jboss/exported/jms/RemoteConnectionFactory " as JNDI name. Use jms/RemoteConnectionFactory as CF reference in your java client.
queue/test as Queue with as jndi name "java:jboss/exported/jms/queue/test ". Use jms/queue/test as Queue reference.
For remote it should start with java:jboss/exported/ else these object won't be exposed and then you can't lookup the CF or Queue.
Also for remote we need to create a application user. Go to the bin folder and start add-user.sh
Create a user jms with a password and add this user to the guest role. Guest role has permission for remote and jms.
Start JBoss with the standalone configuration.
For our java test clients we need to have a jboss and a HornetQ jar file.
First copy jboss-client.jar from the bin/client jboss folder and we need to download the lates HornetQ libraries ( hornetq-2.2.14.Final) . Copy hornetq-jms-client.jar from the HornetQ lib folder.
First the Jms Send Client
Jms Receive Client
In this example I use the same username , password for createQueueConnection
QueueConnection qcon = qconFactory.
If you don't do this you will get this error Unable to validate user: null
INFO: JBoss Remoting version 3.2.3.GA
Exception in thread "main" javax.jms.
at org.hornetq.core.protocol.
Caused by: HornetQException[errorCode=105 message=Unable to validate user: null]
To solve this you can also disable messaging security
Now you can also use QueueConnection qcon = qconFactory.createQueueConnection();