users@glassfish.java.net

Re: Problem sending JMS messages from stateless SB

From: <glassfish_at_javadesktop.org>
Date: Tue, 24 Mar 2009 06:47:30 PDT

I think we may have resolved this but I would like some feedback on our discovery.

We have discovered that if we call createConnection() on the ConnectionFactory EACH TIME we need to send a message and then call close() on the connection after we send our message - all of this in our SLSB - everything appears to work properly. In other words, the problem is gone if we do this.

The big change here is that we previously had a private instance variable to hold the Connection. This was initialized in our @PostConstruct and closed in our @PreDestroy. This pattern follows all example code I've seen including the sample code that goes with the JAVAEE5 tutorial. This also works fine in a MDB but apparently does not work in a SLSB in Glassfish (works in JBoss and WebLogic).

The only reason I even tried this change was a caution under MDB tuning in the Glassfish 2.1 documentation that says you cannot reuse connections if you use global transactions. And we are using global transactions.

We also verified that the problem and solution exists with the built in glassfish JMS, not only with Tibco. So have we found a bug in Glassfish or a problem with the documentation? It appears that one or the other has a problem but perhaps not.
[Message sent by forum member 'patrick_d' (patrick_d)]

http://forums.java.net/jive/thread.jspa?messageID=338695