ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General IBM MQ Support » NullPointerException while posting message

Post new topic  Reply to topic
 NullPointerException while posting message « View previous topic :: View next topic » 
Author Message
jimleo
PostPosted: Tue Jan 25, 2011 8:37 am    Post subject: NullPointerException while posting message Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Tue Jan 25, 2011 8:41 am    Post subject: Re: NullPointerException while posting message Reply with quote

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
View user's profile Send private message
jimleo
PostPosted: Tue Jan 25, 2011 8:56 am    Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Tue Jan 25, 2011 9:13 am    Post subject: Reply with quote

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
View user's profile Send private message
jimleo
PostPosted: Tue Jan 25, 2011 9:24 am    Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Tue Jan 25, 2011 9:30 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Tue Jan 25, 2011 3:08 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Vitor
PostPosted: Wed Jan 26, 2011 5:02 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Wed Jan 26, 2011 8:38 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » NullPointerException while posting message
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.