ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Nabours <manabo...@yahoo.com>
Subject Re: WebSphere 5.1.X -- LocalTransaction rolled-back due to setRollbackOnly
Date Sat, 29 Jan 2005 07:28:30 GMT
Clinton,

Thanks for the quick reply.

I'm happy to report that I found a couple of places
where we weren't closing a connection properly that
fell outside our normal connection management.  

I updated the code to close the connections properly
and the Exceptions are gone (Hallelujah).

One quick question, can I configure a
transactionManger although I don't configure a
datasource in the XML since I externally acquire the
connection?  The dtd requires the datasource element I
believe.

Keep up the great work.

Thanks,
Mark


--- Clinton Begin <clinton.begin@gmail.com> wrote:

> Please set
> <transactionManager....commitRequired="true">
> 
> More info is available in the following poorly
> titled wiki (my fault):
> 
>
http://wiki.apache.org/ibatis/Database_20Specific_20Information
> 
> Clinton
> 
> 
> On Fri, 28 Jan 2005 19:09:29 -0800 (PST), Mark
> Nabours
> <manabours@yahoo.com> wrote:
> > 
> > 
> > Hello. 
> > 
> >   
> > 
> > We are currently developing our first application
> with iBATIS, and we are
> > extremely impressed by its design and
> capabilities.  Everything was going
> > great until we deployed our application to WAS 5.1
> utilizing a JNDI
> > datasource. 
> > 
> >   
> > 
> > We end up receiving the following exception: 
> > 
> > [1/28/05 20:31:45:954 CST] 796d3dfd WebGroup E
> SRVE0026E: [Servlet
> > Error]-[LocalTransaction rolled-back due to
> setRollbackOnly]:
> > com.ibm.ws.LocalTransaction.RolledbackException 
> > 
> >   
> > 
> > I've read the following post concerning issues
> with WebSphere: 
> > 
> >
>
http://wiki.apache.org/ibatis/Database_20Specific_20Information
> 
> > 
> >   
> > 
> > But I'm afraid that we cannot implement the
> suggestions since we externally
> > acquire a connection and pass it to the
> SqlMapClient.  Therefore, I'm not
> > sure how or if we can set a transactionManager
> element within our
> > configuration file since it requires a dataSource
> element as a child. 
> > Currently, we do not have a transactionManager
> element at all.  
> > 
> >   
> > 
> > Here is the code we use to pass the connection
> (sorry about the formatting
> > -- I'm using a web-based e-mail editor) : 
> > 
> >   
> > 
> > /** 
> > 
> > * Returns the cached <code>{@link
> SqlMapClient}</code> instance for the
> > DataSource alias. 
> > 
> > */ 
> > 
> > protected SqlMapClient getSqlMapClient(String
> dataSourceAlias) 
> > 
> > throws SQLException { 
> >  
> > 
> > try { 
> >  
> > 
> > SqlMapClient sqlMapClient = 
> > 
> > IBatisSqlMapService.getInstance().getSqlMapClient(
> 
> > 
> > dataSourceAlias); 
> > 
> > if (sqlMapClient.getCurrentConnection() == null) {
> 
> > 
> > //try to acquire a Connection from the abstract
> broker 
> > 
> > try { 
> >  
> > 
> > Connection connection = 
> > 
> > getDatabaseConnection(dataSourceAlias); 
> > 
> > if (connection != null) { 
> > 
> > sqlMapClient.setUserConnection(connection); 
> > 
> > logger.debug( 
> > 
> > "Connection set via Common Services for \"" 
> > 
> > + dataSourceAlias 
> > 
> > + "\"."); 
> > 
> > } else { 
> > 
> > logger.debug( 
> > 
> > "Connection not configured via Common Services for
> \"" 
> > 
> > + dataSourceAlias 
> > 
> > + "\". Assuming iBatis will supply connection."); 
> > 
> > } 
> > 
> > } catch (SQLException e) { 
> >  
> > 
> > logger.debug( 
> > 
> > "Connection not configured via Common Services for
> \"" 
> > 
> > + dataSourceAlias 
> > 
> > + "\". Assuming iBatis will supply connection."); 
> > 
> > } 
> > 
> > } 
> > 
> > return sqlMapClient; 
> > 
> > } catch (IOException e) { 
> > 
> > throw new Error(e); 
> > 
> > } 
> > 
> > } 
> > 
> >   
> > 
> > Also we "clean up" the application supplied user
> connection with the
> > following code: 
> > 
> >   
> > 
> > /** 
> > 
> > * Clear out the <code>{@link Connection}</code>
> instanced stored by this
> > thread's 
> > 
> > * <code>{@link SqlMapClient}</code> instance keyed
> by
> > <code>dataSourceName</code>. 
> > 
> > */ 
> > 
> > public void closeConnection(String dataSourceName)
> throws SQLException { 
> > 
> > try { 
> > 
> > //clear out user connection on sql map 
> >  
> > 
> > SqlMapClient sqlMapClient = 
> > 
> >
>
IBatisSqlMapService.getInstance().getSqlMapClient(dataSourceName);
> 
> > 
> > if (sqlMapClient != null) { 
> >  
> > 
> > //explicitly commit transaction prior to close 
> > 
> > Connection connection =
> sqlMapClient.getCurrentConnection(); 
> > 
> > if (connection != null) { 
> >  
> > 
> 
=== message truncated ===


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250

Mime
View raw message