Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SetAutoCommit(False) Problem using connection pooling and Datasources

1,050 views
Skip to first unread message

Rob Bercik

unread,
Dec 12, 2003, 11:43:22 AM12/12/03
to
Hi,

I'm migrating a web application from Tomcat 4.1 to Websphere 5.x and
I've had to temporarily remove a call to SetAutoCommit(false) because it
prevents our application from running properly. We get an error about not
being able to connect to the database. Here is the corresponding log entry:

[12/2/03 9:31:49:383 EST] 364ec082 PrivExAction W J2CA0114W: No
container-managed authentication alias found for connection factory or
datasource pemsds.
[12/2/03 9:31:49:414 EST] 364ec082 LocalTransact E WLTC0033E: Resource
jdbc/pemsds rolled back in cleanup of unresolved
LocalTransactionContainment.
[12/2/03 9:31:49:461 EST] 364ec082 LocalTransact E WLTC0032E: One or more
resources rolled back. An unresolved LocalTransactionContainment had an
unresolved action of rollback.
[12/2/03 9:31:49:461 EST] 364ec082 WebAppTransac E SRVE0183E:
LocalTransaction rolled-back due to setRollbackOnly
[12/2/03 9:31:49:477 EST] 364ec082 WebGroup E SRVE0026E: [Servlet
Error]-[LocalTransaction rolled-back due to setRollbackOnly]:
com.ibm.ws.LocalTransaction.RolledbackException

I've seen some other mention of this problem on different websites, but I
haven't seen a real solution provided anywhere. Any help would be greatly
appreciated.

Thanks,
-Rob


Ken Hygh

unread,
Dec 12, 2003, 1:29:04 PM12/12/03
to

Gotta fix that first exception by configuring an authentication alias.
Go to the DataSource page, down at the bottom you click the link to J2C
authentication aliases, create one with your desired username &
password, then go back to the DataSource and select the alias you just
created for your container-managed authentication alias.

Ken

Rob Bercik

unread,
Dec 15, 2003, 10:51:15 AM12/15/03
to
This does not seem to be the problem, I am able to login to the database
with or without creating a container-managed authentication alias, but only
after I remove the call to Connection.setAutoCommit(false). So the error
which seems to be indicative of the real problem I am having is not about
the authentication alias, but rather this one:

> > [12/2/03 9:31:49:461 EST] 364ec082 WebAppTransac E SRVE0183E:
LocalTransaction rolled-back due to setRollbackOnly

I have seen a couple of hints that I need to configure a default connection
behaviour for my connection pools but I am not sure where to do this. Any
ideas...?

Thanks,
-Rob


"Ken Hygh" <ken...@nc.rr.com> wrote in message
news:brd1jq$6aq4$1...@news.boulder.ibm.com...

vinodbijlani

unread,
Dec 19, 2003, 9:14:29 AM12/19/03
to
try setting autoCommit=false in the datasource's custom property.

mmis...@waersystems.com

unread,
Mar 17, 2004, 9:28:48 AM3/17/04
to
HI guys,
i am experiencing hte same problems in that i have defined a Datasource in WAS 5.0, and i am connecting to it using plain JDBC.
all the statements get executed successfully, but at the end i got following exception

17/03/04 14:25:17:078 GMT] 1d43948a LocalTransact E WLTC0033E: Resource jdbc/ds2 rolled back in cleanup of unresolved LocalTransactionContainment.

[17/03/04 14:25:17:078 GMT] 1d43948a LocalTransact E WLTC0032E: One or more resources rolled back. An unresolved LocalTransactionContainment had an unresolved action of rollback.

[17/03/04 14:25:17:109 GMT] 1d43948a TraceNLS u No message text associated with key LocalTransaction.rolled-back.due.to.setRollbackOnly in bundle com.ibm.ejs.resources.seriousMessages

[17/03/04 14:25:17:109 GMT] 1d43948a WebAppTransac E LocalTransaction rolled-back due to setRollbackOnly

[17/03/04 14:25:17:141 GMT] 1d43948a WebGroup E SRVE0026E: [Servlet Error]-[LocalTransaction rolled-back due to setRollbackOnly]: com.ibm.ws.LocalTransaction.RolledbackException
at com.ibm.ws.LocalTransaction.LocalTranCoordImpl.cleanup(LocalTranCoordImpl.java:966)
at com.ibm.ws.webcontainer.webapp.WebAppTransactionCollaborator.postInvoke(WebAppTransactionCollaborator.java:208)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:632)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:173)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:199)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:187)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:331)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:432)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:343)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)

i have read in other posts that this is 'just a warning'..but still i cannot understand where is the problem.. i am doing plain JDBC connection..

anyone can help me out?

thanx in advance and regards
marco

Pratap Kode

unread,
Mar 17, 2004, 4:17:20 PM3/17/04
to
hello rob,

when using datasources avoid calling any api such as
setAutoCommit(), setTransactionIsolationLevel() etc when running in a
local or global transaction context. if you do call these methods, the
container throws a IllegalStateException/IsolationChangeException
which caues the transaction to rollback. if you do need to change
connection attributes do it via the configuration of the datasource as
suggested by a previous post.

pratap.

<mmis...@waersystems.com> wrote in message news:<406717901.1079533728376.JavaMail.wasadmin@swg3ws006>...

Laurent P.

unread,
Mar 23, 2004, 2:30:50 AM3/23/04
to
Hi,
I experienced the same pb while migrating an application from
VAJ3.5/WAS3.5 to WSAD/WAS5.
When you do a local transaction in a servlet for example, the Web
Container manage this transaction and at the end of the servlet, it
checks the state of the transaction.
These messages appear when you began a transaction but didn't a commit
or a rollback on the connection. Disabling "autocommit" on the
connection, the Web Container knows that you take a connection, do
some SQL and nothing more (commit or rollback) : the local transaction
is unresolved, so it will do it itself according the extended
transaction properties of the web component (servlet, ejb). By
default, the "Local Transactions - Unresolved-action" is Rollback for
all the web components.
See : http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.websphere.zseries.doc/info/zseries/ae/rjta_useltran.html

What does it mean : you took a connection, did some SQL and didn't
commit or rollbak :
1) You forgot some commit in your code ?
2) Do you have some transaction with only sql SELECT on connection
with autocommit=false? Because you have to do an action
(commit/rollback) before closing connection.
You can try a simple example to verifing this :
-take a connection
-set autocommit to false
-do a SQL select
-close connection without doing a commit before
==> you will have these messages.

In my case, it's was 2 : we have in you framework, a pool connection
class that gives us a connection with autocommit disabled and I added
a rollback on the connection in the method we use to free the
connection when we are doing select.

For information :
You can change de "Local Transactions - Unresolved-action" of each web
component
to "commit" instead of "rollback" and the messages will disappear.
These informations are in the Web Deployment Descriptor.
In WSAD, go to "Servlet", select a Servlet, in the WebSphere
Extensions you have 3 parameters defining the local transaction
behaviours :
- Boundary: BeanMethod/ActivitySession
- Resolver : Application/ContainerAtBoudary
- Unresolved Action : rollback/commit
In WSAD Help, search "Entity bean assembly settings" and "Web
components assembly settings" for more details.

For information :


>try setting autoCommit=false in the datasource's custom property.

This property isn't available for Oracle Datasource. You will have a
DSRA8020E message (see infocenter).

Hope my bad english will help you :-)
Laurent.

mmis...@waersystems.com

unread,
Mar 23, 2004, 4:29:39 AM3/23/04
to
Hi,
ok solved. i have called explicitly connection.setAutoCommit(true) after retrieving the connection.. it worked (and it is a solution according to IBM, since - as they say - XA transactions (the one that i use) have setAutocommit(false) by default

hope this can help someone else

regards
marco

0 new messages