I've seen a lot of posts on the forums both under this topic as well as the datasource topic without any good answers. I posted my message to this forum because I'm using a JCA connection. Here is my configuration:
JBoss 3.0.6: Standard build downloaded from jboss.org
Microsoft SQL Server 2000
Microsoft JDBC Drivers for SQL Server Service Pack 1
In the application I'm having a problem with I have only one stateless session bean. My stateless session bean uses the example mssql-service.xml file with real values filled in. The session bean does makes no updates to the database, it simply selects data and returns it. The stateless session bean is exposed to web services clients using a simple JAX-RPC delegate the receives the calls, decodes the values, they're Strings with special characters, and passes the data on to the stateless session bean and returns the returned data.
I haven't modified any of the default settings for JBoss 3.0.6 with the exception of the login-config.xml file to setup my login domain and axis-config.xml to comment out the security domain so it would use the domain specified in my JAX-RPC components descriptor.
The problem that I'm having is that it seems the transactions created as a result of calling the stateless session bean are never committed. When hitting the server with a reasonable number of hits I eventually get errors indicating that no more connections can be retrieved from the database, XAResource errors, etc. I don't have a hard number for how many hits per second because if I keep going screen to screen quickly I eventually get the exception so no testing software was necessary. The transactions stay open until I receive a timeout: [TxCapsule] Transaction XidImpl [FormatId=257, GlobalId=snakeeyes//6, BranchQual=] timed out. status=STATUS_ACTIVE. Once I start receiving these messages I can successfully begin hitting the session bean again. I have all of my session bean methods, not part of the home interface, marked Required for the value of the transaction element. I initial did not specify this value however specifying the value made no difference. None of my code contains ANY logic to manipulate transactions in any way.
I have seen numerous people having this same problem without any solutions. I'm not sure what information is required to properly diagnose this issue so please post requests for any files and I will post them. I would like to work through this problem completely and post a good solution for everyone that is having this problem. Thanks in advance for your help.
The first thing to check is that you are really closing all your connections. This is easiest if you use 3.0.7 (from cvs) or 3.2 latest or from cvs, since these loudly warn you if you haven't. I don't know how to check this otherwise: quite a few people were certain they were closing all connections but discovered they weren't with the aid of this check.
If you have verified that you are closing all connections and the problem persists on current jboss versions, can you please supply a small test case to reproduce the problem.
Ok, sorry it's taken me so long to get back but this has taken me awhile. It does look like I've found my problem, although I don't understand it. I had to figure out how to build JBoss from source and then get my application properly configured using 3.2RC1 and I also got it running with 3.0.6. I ran it with 3.2RC1 and didn't get anything other than the Transaction time out so I wrote a little test case that didn't close it's connection to see what it said and saw the messages then about not closing my statements, connections, etc. So, I am closing all of my connections. I then tried to duplicate the problem with a small test case but was unable to reproduce it outside of the application. The reason for that is I wasn't going through web services to get to my session bean, I was accessing it directly using RMI/IIOP. After figured that out I looked into my web services component.
The problem it turns out has to do with my JAX-RPC component that lives inside JBoss and forwards my requests to the EJB. While trying to get access to authenticate users using a security domain other than other I read somewhere in the forum to put this in the web-service.xml file:
<parameter name="securityDomain" value="java:/jaas/MYDOMAIN"/>
Well this seems to cause a Transaction to be created whenever my web service component was accessed, or accesed the my session bean I'm not sure which. When I removed the handler with the type:
The problem went away, no more timed out transactions. I'm not that familiar with how J2EE handles transactions and even less familiar with how Axis handles them but I will continue to look into to it.