Announcement Announcement Module
Collapse
No announcement yet.
JTA, Hibernate and "unresolved LocalTransactionContainm Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JTA, Hibernate and "unresolved LocalTransactionContainm

    Hello all,

    I have implemented parts of an application in an websphere environment (wsad 5.1.1) using spring + hibernate. I have not until now have had the need for JTA, so I have been using org.apache.commons.dbcp.BasicDataSource with a DatasourceTransactionManager. It has worked fine.

    However, I have now tried to configure up an JTA environment and run into some probems. I do not know if the problem is due to Spring or Hibernate, but I'll try this forum.

    At server startup, the spring applicationContext is initialized as well as the hibernate session factory. After all initialization is done, I receive the error "Resource jdbc/CPC_DS rolled back in cleanup of unresolved LocalTransactionContainment."

    I cannot see any errors in the log before this, and the exception stack trace is not very informative.

    During initialization, LocalDataSourceConnectionProvider is initialized. Is this normal using JTA, or could that be the cause of my problem?


    Has anyone come across a similar problem previously? Any help is greatly appreciated!

    Regards
    Niklas

    My bean configuration:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http&#58;//www.springframework.org/dtd/spring-beans.dtd">
    
    <beans>
    	
    	<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiName"><value>java&#58;comp/env/jdbc/CPC_DS.ref</value></property>
    	</bean>
    	
    	
    	<bean id="wsTransactionManager" class="org.springframework.transaction.jta.WebSphereTransactionManagerFactoryBean" /> 
    	<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> 
    		<property name="transactionManager"> 
    			<ref local="wsTransactionManager" /> 
    		</property> 
    	</bean> 
    	
    	
    	<!-- Hibernate SessionFactory -->
    	<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
    		<property name="dataSource"><ref local="dataSource"/></property>
    		
    		<property name="mappingResources">
    			<list>
    		        <value>hbm/generated/XXXX.hbm.xml</value>
    			</list>
    		</property>
    		
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">net.sf.hibernate.dialect.OracleDialect</prop>
    				<prop key="hibernate.connection.pool_size">3</prop>
    				<prop key="hibernate.show_sql">true</prop>								
    			</props>
    		</property>
    	</bean>
    
    <further configuration omitted>
    
    </beans>
    log:
    Code:
    &#91;2005-01-14 15&#58;59&#58;20&#58;516 CET&#93; 3c89a97a ContextLoader I org.springframework.web.context.ContextLoader  Root WebApplicationContext&#58; initialization started
    &#91;2005-01-14 15&#58;59&#58;20&#58;516 CET&#93; 3c89a97a WebGroup      I SRVE0180I&#58; &#91;cpcWeb&#93; &#91;/cpcWeb&#93; &#91;Servlet.LOG&#93;&#58; Loading Spring root WebApplicationContext
    &#91;2005-01-14 15&#58;59&#58;20&#58;672 CET&#93; 3c89a97a XmlBeanDefini I org.springframework.beans.factory.xml.XmlBeanDefinitionReader  Loading XML bean definitions from class path resource &#91;applicationContext.xml&#93;
    &#91;2005-01-14 15&#58;59&#58;20&#58;938 CET&#93; 3c89a97a XmlWebApplica I org.springframework.web.context.support.XmlWebApplicationContext  Bean factory for application context &#91;org.springframework.web.context.support.XmlWebApplicationContext;hashCode=23374191&#93;&#58; org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;dataSource,wsTransactionManager,transactionManager,sessionFactory,cpcDao,soiDao,segmentDao,cpcItemHandler,soiHandler,segmentHandler,cpcFacade,txProxyTemplate,testFacade,testFacadeTarget,buyingAgreementFacade,buyingAgreementFacadeTarget,calculationFacade,calculationFacadeTarget,centralParamFacade,centralParamFacadeTarget,itemFacade,itemFacadeTarget,importFacade,importFacadeTarget,systemFacade,systemFacadeTarget&#93;; root of BeanFactory hierarchy
    &#91;2005-01-14 15&#58;59&#58;20&#58;969 CET&#93; 3c89a97a XmlWebApplica I org.springframework.web.context.support.XmlWebApplicationContext  26 beans defined in application context &#91;org.springframework.web.context.support.XmlWebApplicationContext;hashCode=23374191&#93;
    &#91;2005-01-14 15&#58;59&#58;21&#58;000 CET&#93; 3c89a97a XmlWebApplica I org.springframework.web.context.support.XmlWebApplicationContext  Unable to locate MessageSource with name 'messageSource'&#58; using default &#91;org.springframework.context.support.StaticMessageSource&#58; &#123;&#125;&#93;
    &#91;2005-01-14 15&#58;59&#58;21&#58;016 CET&#93; 3c89a97a XmlWebApplica I org.springframework.web.context.support.XmlWebApplicationContext  Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster'&#58; using default &#91;org.springframework.context.event.SimpleApplicationEventMulticaster@18d7e966&#93;
    &#91;2005-01-14 15&#58;59&#58;21&#58;016 CET&#93; 3c89a97a UiApplication I org.springframework.ui.context.support.UiApplicationContextUtils  No ThemeSource found for &#91;org.springframework.web.context.support.XmlWebApplicationContext;hashCode=23374191&#93;&#58; using ResourceBundleThemeSource
    &#91;2005-01-14 15&#58;59&#58;21&#58;031 CET&#93; 3c89a97a XmlWebApplica I org.springframework.web.context.support.XmlWebApplicationContext  Refreshing listeners
    &#91;2005-01-14 15&#58;59&#58;21&#58;031 CET&#93; 3c89a97a DefaultListab I org.springframework.beans.factory.support.DefaultListableBeanFactory  Pre-instantiating singletons in factory &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;dataSource,wsTransactionManager,transactionManager,sessionFactory,cpcDao,soiDao,segmentDao,cpcItemHandler,soiHandler,segmentHandler,cpcFacade,txProxyTemplate,testFacade,testFacadeTarget,buyingAgreementFacade,buyingAgreementFacadeTarget,calculationFacade,calculationFacadeTarget,centralParamFacade,centralParamFacadeTarget,itemFacade,itemFacadeTarget,importFacade,importFacadeTarget,systemFacade,systemFacadeTarget&#93;; root of BeanFactory hierarchy&#93;
    &#91;2005-01-14 15&#58;59&#58;21&#58;031 CET&#93; 3c89a97a DefaultListab I org.springframework.beans.factory.support.DefaultListableBeanFactory  Creating shared instance of singleton bean 'dataSource'
    &#91;2005-01-14 15&#58;59&#58;21&#58;297 CET&#93; 3c89a97a JndiObjectFac I org.springframework.jndi.JndiObjectFactoryBean  Located object with JNDI name &#91;java&#58;comp/env/jdbc/CPC_DS.ref&#93;&#58; value=&#91;com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource@4b646965&#93;
    &#91;2005-01-14 15&#58;59&#58;21&#58;312 CET&#93; 3c89a97a DefaultListab I org.springframework.beans.factory.support.DefaultListableBeanFactory  Creating shared instance of singleton bean 'wsTransactionManager'
    &#91;2005-01-14 15&#58;59&#58;21&#58;312 CET&#93; 3c89a97a WebSphereTran I org.springframework.transaction.jta.WebSphereTransactionManagerFactoryBean  Found WebSphere 5.1&#58; com.ibm.ws.Transaction.TransactionManagerFactory
    &#91;2005-01-14 15&#58;59&#58;21&#58;312 CET&#93; 3c89a97a DefaultListab I org.springframework.beans.factory.support.DefaultListableBeanFactory  Creating shared instance of singleton bean 'transactionManager'
    &#91;2005-01-14 15&#58;59&#58;21&#58;391 CET&#93; 3c89a97a JtaTransactio I org.springframework.transaction.jta.JtaTransactionManager  Using JTA UserTransaction &#91;com.ibm.ws.Transaction.JTA.UserTransactionImpl@4ee0e96b&#93; from JNDI location &#91;java&#58;comp/UserTransaction&#93;
    &#91;2005-01-14 15&#58;59&#58;21&#58;391 CET&#93; 3c89a97a DefaultListab I org.springframework.beans.factory.support.DefaultListableBeanFactory  Creating shared instance of singleton bean 'sessionFactory'
    &#91;2005-01-14 15&#58;59&#58;21&#58;469 CET&#93; 3c89a97a Environment   I net.sf.hibernate.cfg.Environment  Hibernate 2.1.7
    &#91;2005-01-14 15&#58;59&#58;21&#58;469 CET&#93; 3c89a97a Environment   I net.sf.hibernate.cfg.Environment  hibernate.properties not found
    &#91;2005-01-14 15&#58;59&#58;21&#58;484 CET&#93; 3c89a97a Environment   I net.sf.hibernate.cfg.Environment  using CGLIB reflection optimizer
    &#91;2005-01-14 15&#58;59&#58;21&#58;484 CET&#93; 3c89a97a Environment   I net.sf.hibernate.cfg.Environment  using JDK 1.4 java.sql.Timestamp handling
    &#91;2005-01-14 15&#58;59&#58;22&#58;047 CET&#93; 3c89a97a Binder        I net.sf.hibernate.cfg.Binder  Mapping class&#58; ***
    &#91;2005-01-14 15&#58;59&#58;23&#58;391 CET&#93; 3c89a97a LocalSessionF I org.springframework.orm.hibernate.LocalSessionFactoryBean  Building new Hibernate SessionFactory
    &#91;2005-01-14 15&#58;59&#58;23&#58;391 CET&#93; 3c89a97a Configuration I net.sf.hibernate.cfg.Configuration  processing one-to-many association mappings
    &#91;2005-01-14 15&#58;59&#58;23&#58;391 CET&#93; 3c89a97a Binder        I net.sf.hibernate.cfg.Binder  Mapping collection&#58; ***
    &#91;2005-01-14 15&#58;59&#58;23&#58;469 CET&#93; 3c89a97a Configuration I net.sf.hibernate.cfg.Configuration  processing one-to-one association property references
    &#91;2005-01-14 15&#58;59&#58;23&#58;469 CET&#93; 3c89a97a Configuration I net.sf.hibernate.cfg.Configuration  processing foreign key constraints
    &#91;2005-01-14 15&#58;59&#58;23&#58;547 CET&#93; 3c89a97a Dialect       I net.sf.hibernate.dialect.Dialect  Using dialect&#58; net.sf.hibernate.dialect.OracleDialect
    &#91;2005-01-14 15&#58;59&#58;23&#58;578 CET&#93; 3c89a97a SettingsFacto I net.sf.hibernate.cfg.SettingsFactory  Use outer join fetching&#58; true
    &#91;2005-01-14 15&#58;59&#58;23&#58;578 CET&#93; 3c89a97a ConnectionPro I net.sf.hibernate.connection.ConnectionProviderFactory  Initializing connection provider&#58; org.springframework.orm.hibernate.LocalDataSourceConnectionProvider
    &#91;2005-01-14 15&#58;59&#58;23&#58;594 CET&#93; 3c89a97a TransactionMa I net.sf.hibernate.transaction.TransactionManagerLookupFactory  No TransactionManagerLookup configured &#40;in JTA environment, use of process level read-write cache is not recommended&#41;
    &#91;2005-01-14 15&#58;59&#58;24&#58;438 CET&#93; 3c89a97a WSRdbDataSour I DSRA8203I&#58; Database product name &#58; Oracle
    &#91;2005-01-14 15&#58;59&#58;24&#58;453 CET&#93; 3c89a97a WSRdbDataSour I DSRA8204I&#58; Database product version &#58; Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.4.0 - Production
    &#91;2005-01-14 15&#58;59&#58;24&#58;453 CET&#93; 3c89a97a WSRdbDataSour I DSRA8205I&#58; JDBC driver name  &#58; Oracle JDBC driver
    &#91;2005-01-14 15&#58;59&#58;24&#58;453 CET&#93; 3c89a97a WSRdbDataSour I DSRA8206I&#58; JDBC driver version  &#58; 9.2.0.3.0
    &#91;2005-01-14 15&#58;59&#58;24&#58;922 CET&#93; 3c89a97a SettingsFacto I net.sf.hibernate.cfg.SettingsFactory  Use scrollable result sets&#58; true
    &#91;2005-01-14 15&#58;59&#58;24&#58;922 CET&#93; 3c89a97a SettingsFacto I net.sf.hibernate.cfg.SettingsFactory  Use JDBC3 getGeneratedKeys&#40;&#41;&#58; false
    &#91;2005-01-14 15&#58;59&#58;24&#58;922 CET&#93; 3c89a97a SettingsFacto I net.sf.hibernate.cfg.SettingsFactory  Optimize cache for minimal puts&#58; false
    &#91;2005-01-14 15&#58;59&#58;24&#58;922 CET&#93; 3c89a97a SettingsFacto I net.sf.hibernate.cfg.SettingsFactory  echoing all SQL to stdout
    &#91;2005-01-14 15&#58;59&#58;24&#58;938 CET&#93; 3c89a97a SettingsFacto I net.sf.hibernate.cfg.SettingsFactory  Query language substitutions&#58; &#123;&#125;
    &#91;2005-01-14 15&#58;59&#58;24&#58;938 CET&#93; 3c89a97a SettingsFacto I net.sf.hibernate.cfg.SettingsFactory  cache provider&#58; net.sf.hibernate.cache.EhCacheProvider
    &#91;2005-01-14 15&#58;59&#58;24&#58;938 CET&#93; 3c89a97a Configuration I net.sf.hibernate.cfg.Configuration  instantiating and configuring caches
    &#91;2005-01-14 15&#58;59&#58;25&#58;156 CET&#93; 3c89a97a SessionFactor I net.sf.hibernate.impl.SessionFactoryImpl  building session factory
    &#91;2005-01-14 15&#58;59&#58;26&#58;766 CET&#93; 3c89a97a SessionFactor I net.sf.hibernate.impl.SessionFactoryObjectFactory  Not binding factory to JNDI, no JNDI name configured
    &#91;2005-01-14 15&#58;59&#58;26&#58;766 CET&#93; 3c89a97a DefaultListab I org.springframework.beans.factory.support.DefaultListableBeanFactory  Creating shared instance of singleton bean 'soiDao'
    &#91;2005-01-14 15&#58;59&#58;26&#58;953 CET&#93; 3c89a97a XmlBeanDefini I org.springframework.beans.factory.xml.XmlBeanDefinitionReader  Loading XML bean definitions from class path resource &#91;org/springframework/jdbc/support/sql-error-codes.xml&#93;
    &#91;2005-01-14 15&#58;59&#58;26&#58;984 CET&#93; 3c89a97a XmlBeanFactor I org.springframework.beans.factory.xml.XmlBeanFactory  Creating shared instance of singleton bean 'DB2'
    &#91;2005-01-14 15&#58;59&#58;27&#58;000 CET&#93; 3c89a97a XmlBeanFactor I org.springframework.beans.factory.xml.XmlBeanFactory  Creating shared instance of singleton bean 'HSQL'
    &#91;2005-01-14 15&#58;59&#58;27&#58;000 CET&#93; 3c89a97a XmlBeanFactor I org.springframework.beans.factory.xml.XmlBeanFactory  Creating shared instance of singleton bean 'MS-SQL'
    &#91;2005-01-14 15&#58;59&#58;27&#58;000 CET&#93; 3c89a97a XmlBeanFactor I org.springframework.beans.factory.xml.XmlBeanFactory  Creating shared instance of singleton bean 'MySQL'
    &#91;2005-01-14 15&#58;59&#58;27&#58;000 CET&#93; 3c89a97a XmlBeanFactor I org.springframework.beans.factory.xml.XmlBeanFactory  Creating shared instance of singleton bean 'Oracle'
    &#91;2005-01-14 15&#58;59&#58;27&#58;000 CET&#93; 3c89a97a XmlBeanFactor I org.springframework.beans.factory.xml.XmlBeanFactory  Creating shared instance of singleton bean 'Informix'
    &#91;2005-01-14 15&#58;59&#58;27&#58;000 CET&#93; 3c89a97a XmlBeanFactor I org.springframework.beans.factory.xml.XmlBeanFactory  Creating shared instance of singleton bean 'PostgreSQL'
    &#91;2005-01-14 15&#58;59&#58;27&#58;016 CET&#93; 3c89a97a XmlBeanFactor I org.springframework.beans.factory.xml.XmlBeanFactory  Creating shared instance of singleton bean 'Sybase'
    &#91;2005-01-14 15&#58;59&#58;27&#58;016 CET&#93; 3c89a97a SQLErrorCodes I org.springframework.jdbc.support.SQLErrorCodesFactory  SQLErrorCodes loaded&#58; &#91;HSQL Database Engine, Oracle, Sybase SQL Server, Informix Dynamic Server, Microsoft SQL Server, PostgreSQL, MySQL, DB2*&#93;
    &#91;2005-01-14 15&#58;59&#58;27&#58;047 CET&#93; 3c89a97a DefaultListab I org.springframework.beans.factory.support.DefaultListableBeanFactory  Creating shared instance of singleton bean 'segmentDao'
    &#91;2005-01-14 15&#58;59&#58;27&#58;234 CET&#93; 3c89a97a CollectionFac I org.springframework.core.CollectionFactory  Using JDK 1.4 collections
    &#91;2005-01-14 15&#58;59&#58;27&#58;297 CET&#93; 3c89a97a DefaultListab I org.springframework.beans.factory.support.DefaultListableBeanFactory  Creating shared instance of singleton bean 'buyingAgreementFacade'
    &#91;2005-01-14 15&#58;59&#58;27&#58;453 CET&#93; 3c89a97a ContextLoader I org.springframework.web.context.ContextLoader  Using context class &#91;org.springframework.web.context.support.XmlWebApplicationContext&#93; for root WebApplicationContext
    &#91;2005-01-14 15&#58;59&#58;27&#58;453 CET&#93; 3c89a97a ContextLoader I org.springframework.web.context.ContextLoader  Root WebApplicationContext&#58; initialization completed in 6937 ms
    &#91;2005-01-14 15&#58;59&#58;27&#58;469 CET&#93; 3c89a97a LocalTranCoor E WLTC0033E&#58; Resource jdbc/CPC_DS rolled back in cleanup of unresolved LocalTransactionContainment.
    &#91;2005-01-14 15&#58;59&#58;27&#58;500 CET&#93; 3c89a97a LocalTranCoor E WLTC0032E&#58; One or more resources rolled back. An unresolved LocalTransactionContainment had an unresolved action of rollback.
    &#91;2005-01-14 15&#58;59&#58;27&#58;500 CET&#93; 3c89a97a WebAppTransac E WTRN0043I&#58; LocalTransaction rolled-back due to setRollbackOnly.
    &#91;2005-01-14 15&#58;59&#58;27&#58;578 CET&#93; 3c89a97a WebGroup      E SRVE0020E&#58; &#91;Servlet Error&#93;-&#91;EJBContextLoaderServlet&#93;&#58; Failed to load servlet&#58; com.ibm.ws.LocalTransaction.RolledbackException
    	at com.ibm.ws.LocalTransaction.LocalTranCoordImpl.cleanup&#40;LocalTranCoordImpl.java&#58;1073&#41;
    	at com.ibm.ws.webcontainer.webapp.WebAppTransactionCollaborator.postInvoke&#40;WebAppTransactionCollaborator.java&#58;249&#41;
    	at com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet&#40;WebAppServletManager.java&#58;885&#41;
    	at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet&#40;WebAppServletManager.java&#58;224&#41;
    	at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadAutoLoadServlets&#40;WebAppServletManager.java&#58;542&#41;
    	at com.ibm.ws.webcontainer.webapp.WebApp.loadServletManager&#40;WebApp.java&#58;1277&#41;
    	at com.ibm.ws.webcontainer.webapp.WebApp.init&#40;WebApp.java&#58;283&#41;
    	at com.ibm.ws.webcontainer.srt.WebGroup.loadWebApp&#40;WebGroup.java&#58;387&#41;
    	at com.ibm.ws.webcontainer.srt.WebGroup.init&#40;WebGroup.java&#58;209&#41;
    	at com.ibm.ws.webcontainer.WebContainer.addWebApplication&#40;WebContainer.java&#58;987&#41;
    	at com.ibm.ws.runtime.component.WebContainerImpl.install&#40;WebContainerImpl.java&#58;136&#41;
    	at com.ibm.ws.runtime.component.WebContainerImpl.start&#40;WebContainerImpl.java&#58;356&#41;
    	at com.ibm.ws.runtime.component.ApplicationMgrImpl.start&#40;ApplicationMgrImpl.java&#58;418&#41;
    	at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart&#40;DeployedApplicationImpl.java&#58;787&#41;
    	at com.ibm.ws.runtime.component.DeployedModuleImpl.start&#40;DeployedModuleImpl.java&#58;354&#41;
    	at com.ibm.ws.runtime.component.DeployedApplicationImpl.start&#40;DeployedApplicationImpl.java&#58;575&#41;
    	at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication&#40;ApplicationMgrImpl.java&#58;271&#41;
    	at com.ibm.ws.runtime.component.ApplicationMgrImpl.start&#40;ApplicationMgrImpl.java&#58;249&#41;
    	at com.ibm.ws.runtime.component.ContainerImpl.startComponents&#40;ContainerImpl.java&#58;536&#41;
    	at com.ibm.ws.runtime.component.ContainerImpl.start&#40;ContainerImpl.java&#58;413&#41;
    	at com.ibm.ws.runtime.component.ApplicationServerImpl.start&#40;ApplicationServerImpl.java&#58;125&#41;
    	at com.ibm.ws.runtime.component.ContainerImpl.startComponents&#40;ContainerImpl.java&#58;536&#41;
    	at com.ibm.ws.runtime.component.ContainerImpl.start&#40;ContainerImpl.java&#58;413&#41;
    	at com.ibm.ws.runtime.component.ServerImpl.start&#40;ServerImpl.java&#58;183&#41;
    	at com.ibm.ws.runtime.WsServer.start&#40;WsServer.java&#58;128&#41;
    	at com.ibm.ws.runtime.WsServer.main&#40;WsServer.java&#58;225&#41;
    	at sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41;
    	at sun.reflect.NativeMethodAccessorImpl.invoke&#40;NativeMethodAccessorImpl.java&#58;79&#41;
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;DelegatingMethodAccessorImpl.java&#58;41&#41;
    	at java.lang.reflect.Method.invoke&#40;Method.java&#58;386&#41;
    	at com.ibm.ws.bootstrap.WSLauncher.main&#40;WSLauncher.java&#58;94&#41;
    	at com.ibm.etools.websphere.tools.runner.api.ServerRunnerV5$1.run&#40;ServerRunnerV5.java&#58;97&#41;
    
    &#91;2005-01-14 15&#58;59&#58;27&#58;578 CET&#93; 3c89a97a WebAppServlet E SRVE0183E&#58; LocalTransaction rolled-back due to setRollbackOnly
Working...
X