Despite tons of material, downloads and websites on JAVA enterprise applications, tools and features, there are few sources only for “Let’s get started” styled tutorials. The Netbeans tutorial is often the best starting point (link).
I was reading about the background of JMS, some of the material is of a very theoretical nature and I tried to find some simple sample to get my hands dirty. A good short article on JMS in the glassfish context you can find at java.net (link)
This tutorial describes the steps to get a most simple messaging application up and running implementing a one-to-many communication using topics, also called publish-subscribe. A enterprise client creates a message put it on a topic and a message-driven bean (MDB) retrieves the message.
Using: Netbeans 6.5 with installed Glassfish V2.
1. Creating a new JAVA EE project.

MyJMS Project: New Project
2. We call it MyJMS. Disable the web-application and enable application-client

MyJMS Project: New EE Application
3. We will have a project window with 2 subprojects for the EJB and the application client.

MyJMS Project
4. Before we start with the coding of the EJB and the client, we configure the applicationserver. Open the admin console via right click on the application server under services (Start the server first, if not done yet). You remember the default admin password for glassfish ? “adminadmin”.You better change if your box is open to outside world.

MyJMS: View Admin Console
In the admin console we create the ressources for the JMS topic.

MyJMS: Add Resources
Create a destination resource with JNDI name “jms/topic” and Resource type “javax.jms.topic” (rest default settings).
Create a connection factory with the JNDI name “jms/TopicFactory” (rest default settings, but remove username and password).
Read the rest of this entry »