-
Oct 15th, 2008, 12:25 PM
#1
JMSTemplate as class variable
I struggled with this for a while and figured out the solution, but I don't really understand why. I wanted to know if anyone had any insite into this.
I was obtaining an instance of a jmstemplate from the application context and storing it as a class variable. I would then use that reference to to call convertAndSend()on it. However we noticed that the convertAndSend() was causing null pointer exceptions after some time. I think the underlying connection pooling was causing this issue.
I fixed this by removeing the class level variable and always calling getBean()on the connection factory to get the JMS template and it seems to work all the time. I thought the getbean() was just returning a reference, which I was storing in my class level variable. However it seems that it is also doing some kind of connection cleanup. Does anyone have any idea of what is happening under the covers?
(I am using websphere 6.0 and connected to Websphere MQ with connection pooling enabled) All the JNDI settings are setup inside the container properlyly
Thanks in advance.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules