The connection is a resource managed by the transaction spanning the bean method you called.
The ConnectionManager will close any connection you failed to close when this tx ends (end of call).
You could try to set 'SpecCompliant' to 'true' in transation-service.xml to notify Jboss
not to close any open connections when returning from method call.
Or maybe considering getting the connection from the DataSource directly
in the servlet since it is used in it anyway.
Since my connection bean is container managed. I tried by giving not supportted attribute. still it's not working. also i changed to true in transaction.xml but
the sql exception is
"Connection handle is not currently associated with a ManagedConnection"
If i called the data source directly then ok. But my we are using a bean to retrieven the connection.
is there any ideas are appreciated
thanx for reply
I am still not sure what you are trying to do. I can see the ConnectionManager complaining if there is no tx associated to the connection. You could change, (or add), your DataSource to not be aware of any transactions. Try adding a new child config for the DataSource using <no-tx-datasource>.
i'm explaining in detail.
i'm using a stateless session bean for DBConnection. i'm using mysql DB.This bean is called from the servlet. i have obtained the reference of the bean in servlet. so, i call the method defined in the bean. Only one method is defined in bean which contains(5 lines of code) the lookup of the jndi datasource.connection is obtained in the bean. i'm returning the connection from the bean to the servlet.
It is a container managed bean.first i didn't specified container transaction attribute in the descriptor. I got the error of cachedconnectionmanager successfully closed the connection. and in the exception i caught is"connection has been closed and is unusable".
i hv tried as ur tips. but the same error occured.
i hope now the problem definition is ok.
You can not do that. The web app and the ejb app could run on different VMs and on different boxes. Just wrap the data source lookup and in a helper class if you want to use another class to get the connection for the servlet. Or, you could move the db calls to the ejb app.
thanks a lot for the response. i'm convinced. thanks.