Atomikos Forum

Moving from Atomikos 3.6.5 to 3.7.0

Hi All,

We are currently using Atomikos 3.6.5 with Spring 2.0.8 and Hibernate 3.3. We would like to move to the latest version of 3.7.0. I see that there have been changes in the way the jar files are built (I think its due to the build process using Maven now). Back then we had only one jar - transactions-essentials-all.jar - of around 1.6MB.

I downloaded the latest distribution and built using "ant jars" - which gives me 9 jars. For preliminary testing, I removed the old transactions-essentials-all.jar and included all the 9 jars. But seems like there is more to it. I get the following error on starting the Server :

2011-01-12 21:25:26 HKT [main] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor' defined in class path resource [applicationContext-Data.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext-XaDataSource.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: zpcclass] Unable to build EntityManagerFactory
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext-XaDataSource.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: zpcclass] Unable to build EntityManagerFactory
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: zpcclass] Unable to build EntityManagerFactory
        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:218)
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:251)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1203)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:248)
        at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:257)



Does this migration need any change in configuration ? I rechecked our config with the one provided at http://www.atomikos.com/Documentation/SpringIntegration#The_Basic_Case_Pre_3_3. Everything looks perfect.


Thanks,
Midhun
Midhun Agnihotram Send private email
Wednesday, January 12, 2011
 
 
Hi,

Try adding transactions-osgi.jar plus any transactions-hibernateX.jar you need.

HTH
Guy Pardon Send private email
Wednesday, January 12, 2011
 
 
Hey Guy,

Thanks for the quick reply. It worked fine when I deployed the jars from the distribution rather than the ones that I built. I think I also missed. transaction-osgi.jar.


We are currently facing the following issue (even with the 3.7.0M5 version):

During a transaction, if a valid Business Exception is thrown from the service layer, the control then jumps to the Controller layer. Any database access done after the exception is thrown fails. The Warning and errors are as follows :



WARN  atomikos - Transaction is marked for rollback only or has timed out
com.atomikos.datasource.xa.session.InvalidSessionHandleStateException: Transaction is marked for rollback only or has timed out

WARN  atomikos - Error enlisting in transaction - connection might be broken? Please check the logs for more information...
com.atomikos.jdbc.AtomikosSQLException: Transaction is marked for rollback only or has timed out

WARN  org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: null
2011-01-13 17:19:59 IST [http-8081-Processor25] ERROR org.hibernate.util.JDBCExceptionReporter - Transaction is marked for rollback only or has timed out
2011-01-13 17:19:59 IST [http-8081-Processor25] ERROR com.xxxx.xxxxx.common.web.controller.HandlerExceptionResolver - Handling uncatched exception, referenceCode = 07714781
2011-01-13 17:19:59 IST [http-8081-Processor25] ERROR com.xxxx.xxxxx.common.web.controller.HandlerExceptionResolver - could not execute query
org.hibernate.exception.GenericJDBCException: could not execute query

Caused by: com.atomikos.jdbc.AtomikosSQLException: Transaction is marked for rollback only or has timed out
    at com.atomikos.jdbc.AtomikosSQLException.throwAtomikosSQLException(AtomikosSQLException.java:44)
    at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:206)
    at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:131)
    at $Proxy72.prepareStatement(Unknown Source)
    at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
    at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
    at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
    at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1577)
    at org.hibernate.loader.Loader.doQuery(Loader.java:696)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
    at org.hibernate.loader.Loader.doList(Loader.java:2232)
    ... 90 more
Caused by: com.atomikos.datasource.xa.session.InvalidSessionHandleStateException: Transaction is marked for rollback only or has timed out
    at com.atomikos.datasource.xa.session.NotInBranchStateHandler.checkEnlistBeforeUse(NotInBranchStateHandler.java:59)
    at com.atomikos.datasource.xa.session.TransactionContext.checkEnlistBeforeUse(TransactionContext.java:85)
    at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:176)
    at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:197)
    ... 99 more



WARN  atomikos - atomikos connection pool 'dbs01': error creating proxy of connection an AtomikosXAPooledConnection with a SessionHandleState with 0 context(s)
com.atomikos.datasource.pool.CreateConnectionException: an AtomikosXAPooledConnection with a SessionHandleState with 0 context(s): connection is erroneous
    at com.atomikos.jdbc.AtomikosXAPooledConnection.testUnderlyingConnection(AtomikosXAPooledConnection.java:114)
    at com.atomikos.datasource.pool.AbstractXPooledConnection.createConnectionProxy(AbstractXPooledConnection.java:68)
    at com.atomikos.datasource.pool.ConnectionPool.borrowConnection(ConnectionPool.java:161)
    at com.atomikos.jdbc.AbstractDataSourceBean.getConnection(AbstractDataSourceBean.java:321)
    at com.atomikos.jdbc.AbstractDataSourceBean.getConnection(AbstractDataSourceBean.java:373)
    at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:46)
    at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
    at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
    at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
    at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1577)
    at org.hibernate.loader.Loader.doQuery(Loader.java:696)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
    at org.hibernate.loader.Loader.loadEntity(Loader.java:1885)
    at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:71)
    at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:65)
    at org.hibernate.loader.entity.BatchingEntityLoader.load(BatchingEntityLoader.java:105)
    at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3062)
    at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:434)
    at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:415)
    at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:165)
    at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:223)
    at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:126)
    at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:906)
    at org.hibernate.impl.SessionImpl.get(SessionImpl.java:843)
    at org.hibernate.impl.SessionImpl.get(SessionImpl.java:836)
    at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:182)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:341)
    at $Proxy299.find(Unknown Source)
    at org.springframework.orm.jpa.JpaTemplate$1.doInJpa(JpaTemplate.java:223)
    at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:185)
    at org.springframework.orm.jpa.JpaTemplate.find(JpaTemplate.java:221)
    at com.xxxx.xxxxx.common.data.dao.impl.GenericDaoImpl.findById(GenericDaoImpl.java:266)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy234.findById(Unknown Source)
    at com.xxxx.xxxxx.xxxxx.web.controller.master.LookupUtil.getProcessingUnit(LookupUtil.java:153)
    at org.apache.jsp.template.template_jsp._jspService(template_jsp.java:244)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:594)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:505)
    at com.opensymphony.module.sitemesh.filter.PageFilter.writeDecorator(PageFilter.java:173)
    at com.opensymphony.module.sitemesh.filter.PageFilter.applyDecorator(PageFilter.java:158)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:62)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
    at com.xxxx.xxxxx.common.web.interceptor.UrlPatternSecurityInterceptor.doFilter(UrlPatternSecurityInterceptor.java:64)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
    at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
    at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
    at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:166)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
    at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
    at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
    at com.xxxx.xxxxx.common.web.security.SiteminderAuthenticationProcessingFilter.doFilter(SiteminderAuthenticationProcessingFilter.java:117)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
    at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
    at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
    at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at com.planetj.servlet.filter.compression.CompressingFilter.doFilter(CompressingFilter.java:222)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    at java.lang.Thread.run(Thread.java:595)

2011-01-13 17:19:59 IST [http-8081-Processor25] WARN  atomikos - atomikos connection pool 'dbs01': no connection found - waiting a bit...


After this, the whole stacktrace is then thrown on to the JSP. So, we are losing the database connection once a Business Exception is thrown. I know this is not the full stack trace, I am willing to provide more info if required.

We have been facing this issue for long now. We try out every update of Atomikos to see if that works. :)

DO have anything in mind as to why this is happening ?

Thanks,
Midhun
Midhun Agnihotram Send private email
Thursday, January 13, 2011
 
 
If you are running this one in one transaction this is normal and good.
The first error causes the transaction to rollback (if it is a usual exception from your code which should not cause the tx to rollback configure your transaction annoatation correctly to ignore those exception and let the tx as is) and further access will be denied, because the connection is marked rollback_only.
You should be able to do read_only statement on the connection, but updates can fail fast because you are not able to commit anyway as the tx got already a rollback cause.

So the question here:

Are you doing things (the first call and the second call to your db where the first one fails) in one transaction?
And if you do - is the second call an insert or update or delete statement?
If this is the case you need to get a new transaction or connection which is not bound to the still running transaction and have to do your work.

If you do only a query statement like the trace may show imho this should be allowed (but i am not sure - but the connection should permit it - so this maybe a feature request here for Atomikos to allow queries which do not modify anything), update, insert or delete should be denied like its done.
Torsten Krah Send private email
Thursday, January 13, 2011
 
 
Hi Torsten,

Your reply gave a lot of insight. Thanks a lot ! We are preforming both the calls in the same transaction. Its like this - we display a form with some data, on submitting the form is processed. If there are any exceptions, the form is shown again with the Exception on the top. In the case, after the Exception is thrown, we are accessing the database to show the form data again. This is where it fails. To make it short, yeah - both the calls in the same transaction. The second call is for SELECT statements only - no inserts or updates.

Thanks

Hi Guy,

What do you feel about this ? Will/Should Atomikos be supporting read only SELECTs after an Exception ?


Thanks,
Midhun.
Midhun Agnihotram Send private email
Friday, January 14, 2011
 
 
Did you try closing the connection before doing the second query?
Guy Pardon Send private email
Friday, January 14, 2011
 
 
Hi Guy,

We have not handled connections explicitly anywhere in our application. AFAIK, Atomikos takes care of that. I am not that aware of how to do this. Can you please suggest a small example for a Spring + Hibernate based application ?

Thanks,
Midhun
Midhun Agnihotram Send private email
Friday, January 21, 2011
 
 
Hi,

Try the after_statement release mode for hibernate as outlined here: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/transactions.html#transactions-connection-release

HTH
Guy Pardon Send private email
Friday, January 21, 2011
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics