Source:9.2. Creating a Java SE Client that Sends Messages to a JMS Queue OCP JavaEE 6 EJB Developer Study Notes by Ivan A Krizsan Version: April 8, 2012
As stated in the example,one has to:
If using GlassFish v3, include the appropriate runtime library JAR on the classpath: $GLASSFISH_HOME/modules/gf-client.jar
The location on my system was:
C:\glassfish3\glassfish\lib\gf-client.jar
I added the jar to Lib folder of MessageDrivenBeanSEClient Java Project and then I right-clicked on the jar from the lib folder in eclipse and selected Build Path-->Add to Build Path.
Then I refreshed the Project But still I see the following errors in the MessageDrivenBeanSEClient:
The import javax.jms cannot be resolved
It seems you don't have the JMS libraries on your classpath.
Do the following on your client-project: Right-mouse-click - Properties - Java Build Path - select Tab "Libraries" - Add Library - Server Runtime - select Glassfish - click Finish - click OK.
How did you define the "jms/QueueConnectionFactory" and "jms/QueueDestination"?
You can verify if they are there and they are well defined ( I am assuming that you are using glassfish ) by starting the admin-console (start-up the server, then right-click the server -> Glassfish -> View Admin Console.
After starting-up the admin-console check the
Resources -> JMS Resources -> Connection Factories
Resources -> JMS Resources -> Destination
If they are not there click the New... button and define them under the names you use in your lookup: "jms/QueueConnectionFactory" and "jms/QueueDestination".
I am still facing the issue on the same line of code:
Ravi Bansal
Ranch Hand
Joined: Aug 18, 2008
Posts: 82
posted
0
Mohit,
Can you please try the following
Write A session bean and look up the connectionFactory from session bean (basically whatever you are doing in your Java SE Client)
deploy the session bean
Invoke the session bean from standalone client
If the above works , that will ensure that your server configuration of connection factory and queues is correct.
Something must be wrong in your MDB client , other people who have experienced similiar problems , they fixed it by modifying the classpath.
you need to make sure that you are referring the glassfish-client jar directly from installation directory (not from some other location on your system) because it contains MF file which includes the other liberaries automatically. see below link. Hope this will help you.
Write A session bean and look up the connectionFactory from session bean (basically whatever you are doing in your Java SE Client)
deploy the session bean
Invoke the session bean from standalone client
The above steps worked and I was able to see the following line in server.logs
JMS Resource Loopup Finished.
However,I am still not able to understand what's wrong in the MDB SE client.
I had added the following jar's manually to Lib folder of MessageDrivenBeanSEClient Java Project and then I right-clicked on the jar from the lib folder in eclipse and selected Build Path-->Add to Build Path.
Then I refreshed the Project