Hi all ,
I am studying
J2EE technology.
I have downloaded J2EESDK , j2ee , jms tutoral and jdk1.3 from java.sun.com.
I am working on JMS Api.
In jms tutorial , there are axamples like "SimpleQueueSender" and "SimpleTopicPublisher" in folder "simple".
Now I have done with all the requirements for j2ee server and jdk1.3.
j2ee server runs properly .
I compiled the source code and try to run the above files as per instructions given in tutorial.
"SimpleQueueSender/SimpleTopicPublisher" runs and throws "NullPointerException" with no stack trace available .
Exception occurs when QueueSender tries to send the message to Queue.
I am copying the exception and sample code here for "SimpleQueueSender" .
try {
queueConnection =
queueConnectionFactory.createQueueConnection();
queueSession =
queueConnection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
queueSender = queueSession.createSender(queue);
System.out.println("Sender 1: " + queueSender) ;
message = queueSession.createTextMessage();
for (int i = 0; i < NUM_MSGS; i++) {
message.setText("This is message " + (i + 1));
System.out.println("Sending message: " +
message.getText());
System.out.println("before sending ... ");
queueSender.send(message);
System.out.println("After sending ... ");
}
/////////////////
Error...
Queue name is MyQueue
Java(TM) Message Service 1.0.2 Reference Implementation (build b14)
Sending message: This is message 1
before sending ...
Exception occurred: java.lang.NullPointerException
java.lang.NullPointerException
<<no stack trace available>>
////////////////////
Can anyone Please tell me the reason why there will be NullPointerException ? It happens for both "SimpleQueueSender" and "SimpleTopicPublisher" .. while "SimpleQueueReceiver" and "SimpleTopicSubscriber" works properly .
Thx
Jitendra Sonawane