Author |
Message
|
jimleo |
Posted: Tue Jan 25, 2011 8:37 am Post subject: NullPointerException while posting message |
|
|
Newbie
Joined: 25 Jan 2011 Posts: 3
|
Hi Guyz,
I am getting NullPointerException while posting message to the queue. Stack trace is mentioned below. Can you guyz please help on this.
java.lang.NullPointerException
at com.ibm.mq.jms.MQConnectionFactory.equals(MQConnectionFactory.java:1171)
at com.ibm.mq.jms.MQQueueConnectionFactory.equals(MQQueueConnectionFactory.java:309)
at java.util.HashMap.get(HashMap.java:305)
at org.springframework.transaction.support.TransactionSynchronizationManager.doGetResource(TransactionSynchronizationManager.java:153)
at org.springframework.transaction.support.TransactionSynchronizationManager.getResource(TransactionSynchronizationManager.java:137)
at org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession(ConnectionFactoryUtils.java:269)
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:453)
at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:534)
Thanks,
Jim |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jan 25, 2011 8:41 am Post subject: Re: NullPointerException while posting message |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
jimleo wrote: |
Can you guyz please help on this. |
No. You've not posted:
- the linked exception with the WMQ reason code
- the platform you're running on
- the version of WMQ you're using
- native or JMS
- app server or not
- at exactly what point this error comes out
(from what little you have posted I'd expect it to be much earlier in your code than the actual message put)
Better information, better advice. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
jimleo |
Posted: Tue Jan 25, 2011 8:56 am Post subject: |
|
|
Newbie
Joined: 25 Jan 2011 Posts: 3
|
Hi Vitor,
Thanks for the reply. I am trying to post the message using Spring JMSTemplate in tomcat server. The stack trace doesnt have any error code in it The code is mentioned below.
jmsTemplate.send(queue, new MessageCreator()
{
public Message createMessage(Session session) throws JMSException
{
Message msg = session.createTextMessage(messageText);
msg.setJMSCorrelationID(correlationId);
if(replyTo != null)
{
msg.setJMSReplyTo(replyTo);
}
return msg;
}
});
It is throwing exception in the first line. It is not going inside the createMessage method.
Thanks,
Jim |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jan 25, 2011 9:13 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
jimleo wrote: |
The stack trace doesnt have any error code in it |
No, it doesn't. As I said before, it's in the linked exception, the provider specific one not the generic JMS one.
I also wouldn't know this template from a hole in the ground, but given what the stack trace does say & your assertion that it blows up early this points to a connection error. Can you put a message with the supplied non-Java samples, proving that your WMQ set up is correctly configured & working? Are you sure you've provided the correct connection parameters wherever you need to provide them? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
jimleo |
Posted: Tue Jan 25, 2011 9:24 am Post subject: |
|
|
Newbie
Joined: 25 Jan 2011 Posts: 3
|
It doesnt occur all the time. Sometimes it fails. I think Spring JMSTemplate is having some problems while setting the connectionfactory. I will post the issue in Spring forum.
Thanks alot Vitor for your help. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jan 25, 2011 9:30 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
jimleo wrote: |
I think Spring JMSTemplate is having some problems while setting the connectionfactory. |
The null pointer out of the connection factory is a clue for that indeed.
But I can't help noticing that it's the MQConnectionFactory class that's blowing. If it was a Spring problem I'd rather expect a different class to be reporting an issue.
Still, good luck with the Spring forum. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jan 25, 2011 3:08 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Vitor wrote: |
jimleo wrote: |
I think Spring JMSTemplate is having some problems while setting the connectionfactory. |
The null pointer out of the connection factory is a clue for that indeed.
But I can't help noticing that it's the MQConnectionFactory class that's blowing. If it was a Spring problem I'd rather expect a different class to be reporting an issue.
Still, good luck with the Spring forum. |
Jimleo's assumption is correct. The connection factory returned / compared to has a null value, hence the null pointer exception because the method used for comparison is an instance method and not a static one.
I suspect that something might not quite jive with either the pool size or the setup information and this is why you get the null pointer exception. If it is the pool size you will never see a provider (linked exception) because the code never gets there, the pool being already full.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jan 26, 2011 5:02 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
fjb_saper wrote: |
Jimleo's assumption is correct. The connection factory returned / compared to has a null value, hence the null pointer exception because the method used for comparison is an instance method and not a static one. |
One day I'll learn not to even attempt Java questions...  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jan 26, 2011 8:38 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Vitor wrote: |
fjb_saper wrote: |
Jimleo's assumption is correct. The connection factory returned / compared to has a null value, hence the null pointer exception because the method used for comparison is an instance method and not a static one. |
One day I'll learn not to even attempt Java questions...  |
Don't be so negative. It is through our mistakes that we learn  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|