I want to run jms tutorial files in eclipse. I configured GlassFish correctly and added jms resources. It works fine if I run it in netbeans.
In eclipse, I created a "client application project".
Resources are loaded here:
@Resource(mappedName = "jms/ConnectionFactory") private static ConnectionFactory connectionFactory; @Resource(mappedName = "jms/Queue") private static Queue queue; @Resource(mappedName = "jms/Topic") private static Topic topic;
Then when he gets here:
connection = connectionFactory.createConnection();
I get a NullPointerException. For some reason, it does not receive resources from the server, so they are zero.
It works if I create a project in eclipse and then run it from the command line using appclient:
appclient Producer topic 4
It says http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jst.j2ee.doc.user%2Ftopics%2Fcjappcliproj.html that:
The application client module is used to contain a fully functional client Java ™ application (not a web interface) that connects to Java and uses its EE resources defined on your server. When you place the client code in the client module of the application instead of a simple JAR file, the Benefits of the client application from server resources (it is not necessary to re-specify the class path to Java EE files and the JAR server), as well as from a simpler JNDI search (the client container fills initial context and other parameters).
So it seems like I'm on the right track, but maybe I am missing some eclipse configuration.
source share