Hello,
I have a standalone desktop application 'A' which needs to send messages to remote application 'B' running inside a
JEE container. Application B has a JMS-queue to recieve messages. Application A should have minimal changes, and for Application B I have no access to functionality or source code whatsoever.
So the plan is to make a jar-library which can be used by creating a single call with some parameters to it from within Application A. The library should put messages on the queue in Application B.
I followed the
Java EE 5 tutorial from oracle, in particular the part about JMS that has a 'server' (earthmdb demo) and a client (jupiterclient demo) running separately (
http://docs.oracle.com/javaee/5/tutorial/doc/bnchx.html). I use the 'server' to mimic Application B so I can
test my code. It is a simple class implementing the MessageListener interface and an onMessage() method. This is working just fine; I see messages get send from the client-application and they're being received in the onMessage() method correctly.
However, they both run inside the same Glassfish container. So I tried to seperate the client to a standalone application to eventually be able to put it in a jar that is to be used by application A.
I used Apache ActiveMQ as a JEE implementation, so I don't need to run inside a JEE/glassfish-container. The messages are send to "TapServiceQueue" running in the glassfish-container on the same machine (for now) on port 17294. My code runs, messages get send, but they are not received on the server-side somehow :/
Here's is the code of my client class:
I created my app as a Maven-app inside netbeans, so dependencies are taken care of automatically.
In my client I do a createQueue:
This seems rather strange to me, since the queue already exists. I've been searching for ages for a solution now, but there does not seem to be a way to get an existing queue reference :s How to do this? Can you guys see something wrong in my code? Or is my approach not the correct one somehow?
Any suggestions?
OS: Ubuntu 11.04
JAVA: 1.7
JEE: 5
IDE: Netbeans 7.2
JEE-container: Glassfish 3+
For completeness, here is the server-side code