This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes EJB and other Java EE Technologies and the fly likes JMS: Cannot initialize ConnectionFactory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JMS: Cannot initialize ConnectionFactory " Watch "JMS: Cannot initialize ConnectionFactory " New topic
Author

JMS: Cannot initialize ConnectionFactory

Joe Cheung
Ranch Hand

Joined: Oct 18, 2002
Posts: 104
Hi all,

I am learning JMS and so I have downloaded "Java EE SDK 5 Update 2" (available at https://sdlc5a.sun.com/ECom/EComActionServlet;jsessionid=500D73F57050D281F4B6B 5289DA3C254) and installed it on my window machine. From the package, I can use "Sun Java System Application Server" to define the necessary resources used in the JMS example programs. I have followed the instruction to create the resources before I run the example with the following output to confirm that ConnectionFactory, Queue and Topic are successfully created:

C:\temp>asadmin list-jms-resources
jms/Queue
jms/Topic
jms/ConnectionFactory
Command list-jms-resources executed successfully.

C:\temp>

However, I got NullPointerException for when I executed the Producer.java (http://java.sun.com/javaee/5/docs/tutorial/examples/jms/simple/producer/src/java/Producer.java) that the ConnectionFactory cannot be created:

@Resource(mappedName = "jms/ConnectionFactory")
private static ConnectionFactory connectionFactory;
.........................
Connection connection = connectionFactory.createConnection(); // NullPointerException here

Do you think I have sth missing to be defined or created in the "Sun Java System Application Server" or anything else?

Thanks,
Joe


Joe
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JMS: Cannot initialize ConnectionFactory