[Persistence, JBoss/CMP, Hibernate, Database] - org.hibernate.StaleObjectStateException
by kapil.singhal
Hello,
I am using JBoss 4.2.2 GA and using Postgres as database.
I am having entities at the Backend layer and on top of it I am exposing backend methods from a Stateless Session Bean as a Web Service.
When a client is using the Web Service at times StaleObjectException is raised. It is not consistent but it occurs many times.
Stacktrace is as below:
17:01:00,090 ERROR [ AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.barco.cms.eventmgt.EventQueue#20]
at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1765)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2407)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2307)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2607)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:92)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
at com.barco.cms.eventmgt.EventQueuePoolImpl.createEventQueue(EventQueuePoolImpl.java:121)
at com.barco.cms.eventmgt.EventQueuePoolImpl.subscribeEvent(EventQueuePoolImpl.java:234)
at com.barco.cms.openapi.OpenAPIImpl.subscribePool(OpenAPIImpl.java:227)
at com.barco.cms.openapi.PerspectiveMgtAPIImpl.subscribeSourcePool(PerspectiveMgtAPIImpl.java:7202)
at sun.reflect.GeneratedMethodAccessor118.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
at com.barco.cms.openapi.PerspectiveMgtAPIImpl.initialSteps(PerspectiveMgtAPIImpl.java:236)
at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:146)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:387)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
17:01:00,168 ERROR [ OpenAPIImpl] Throw Internal Error..
InternalError [Type=InternalError, Source=subscribeSourcePool, Description=Some unexpected error occurred while calling this method. Please contact Barco Customer Support.]
at com.barco.cms.openapi.OpenAPIImpl.throwInternalError(OpenAPIImpl.java:461)
at com.barco.cms.openapi.PerspectiveMgtAPIImpl.initialSteps(PerspectiveMgtAPIImpl.java:306)
at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:146)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:387)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
Caused by: javax.persistence.OptimisticLockException
at org.hibernate.ejb.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:642)
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:599)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73)
at com.barco.cms.eventmgt.EventQueuePoolImpl.createEventQueue(EventQueuePoolImpl.java:121)
at com.barco.cms.eventmgt.EventQueuePoolImpl.subscribeEvent(EventQueuePoolImpl.java:234)
at com.barco.cms.openapi.OpenAPIImpl.subscribePool(OpenAPIImpl.java:227)
at com.barco.cms.openapi.PerspectiveMgtAPIImpl.subscribeSourcePool(PerspectiveMgtAPIImpl.java:7202)
at sun.reflect.GeneratedMethodAccessor118.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
at com.barco.cms.openapi.PerspectiveMgtAPIImpl.initialSteps(PerspectiveMgtAPIImpl.java:236)
... 31 more
Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.barco.cms.eventmgt.EventQueue#20]
at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1765)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2407)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2307)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2607)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:92)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
... 41 more
Any help will be appreciated.
Thanks & Regards
Kapil
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111373#4111373
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111373
18 years, 4 months
[JBoss Seam] - Re: SeamTest Unit Tests Working...But Not Integration Tests
by pete.muir@jboss.org
The classpath stuff for tests is *horrible* and we really need to improve on it. I will try to write this up in the guide asap.
"neilac333" wrote : 'C:\project\libs\testing\testng\testng-5.6-jdk15.jar;
| C:\project\persistence\dist\project-persistence.jar;
| C:\project\libs\seam-hibernate\groovy-all.jar;
| C:\project\libs\seam-hibernate\hibernate-all.jar;
| C:\project\libs\seam-hibernate\jboss-deployers.jar;
| C:\project\libs\seam-hibernate\jboss-ejb3-all.jar;
This certainly shouldn't be there, its part of embedded ejb3, so contains a much older distro of JBoss
anonymous wrote : C:\project\libs\seam-hibernate\jboss-embedded-all.jar;
| C:\project\libs\seam-hibernate\jboss-embedded-api.jar;
| C:\project\libs\seam-hibernate\jcaptcha-all.jar;
| C:\project\libs\seam-hibernate\thirdparty-all.jar;
| C:\project\libs\seam-hibernate\bootstrap;
| C:\project\libs\sun-jsf\el-api.jar;
| C:\project\libs\sun-jsf\el-ri.jar;
Shouldn't be there in Seam 2 at all.
anonymous wrote : C:\project\libs\sun-jsf\jsf-api.jar;
| C:\project\libs\sun-jsf\jsf-impl.jar;
| C:\project\libs\sun-jsf\jstl.jar;
| C:\project\libs\sun-jsf\servlet-api.jar;
| C:\project\libs\commons\commons-beanutils.jar;
| C:\project\libs\commons\commons-collections.jar;
| C:\project\libs\commons\commons-digester.jar;
| C:\project\libs\commons\commons-discovery.jar;
| C:\project\libs\commons\commons-el.jar;
Don't want this either (another implementation of EL)
anonymous wrote : C:\project\libs\commons\commons-fileupload.jar;
| C:\project\libs\commons\commons-lang.jar;
| C:\project\libs\commons\commons-logging-api.jar;
| C:\project\libs\commons\commons-logging.jar;
| C:\project\libs\seam-hibernate\activation.jar;
| C:\project\libs\seam-hibernate\ant-antlr.jar;
| C:\project\libs\seam-hibernate\antlr-runtime.jar;
| C:\project\libs\seam-hibernate\antlr.jar;
| C:\project\libs\seam-hibernate\asm-attrs.jar;
| C:\project\libs\seam-hibernate\asm.jar;
anonymous wrote : C:\project\libs\seam-hibernate\bootstrap\conf\bootstrap-beans.xml;
| C:\project\libs\seam-hibernate\bootstrap\conf\jboss-service.xml;
| C:\project\libs\seam-hibernate\bootstrap\conf\jbossjta-properties.xml;
| C:\project\libs\seam-hibernate\bootstrap\conf\login-config.xml;
| C:\project\libs\seam-hibernate\bootstrap\conf\props\messaging-roles.properties;
| C:\project\libs\seam-hibernate\bootstrap\conf\props\messaging-users.properties;
| C:\project\libs\seam-hibernate\bootstrap\data\hypersonic\dvd.log;
| C:\project\libs\seam-hibernate\bootstrap\data\hypersonic\dvd.properties;
| C:\project\libs\seam-hibernate\bootstrap\data\hypersonic\localDB.lck;
| C:\project\libs\seam-hibernate\bootstrap\data\hypersonic\localDB.log;
| C:\project\libs\seam-hibernate\bootstrap\data\hypersonic\localDB.properties;
| C:\project\libs\seam-hibernate\bootstrap\data\hypersonic\localDB.script;
| C:\project\libs\seam-hibernate\bootstrap\data\jboss.identity;
| C:\project\libs\seam-hibernate\bootstrap\deploy\ejb3-interceptors-aop.xml;
| C:\project\libs\seam-hibernate\bootstrap\deploy\hsqldb-ds.xml;
| C:\project\libs\seam-hibernate\bootstrap\deploy\jboss-local-jdbc.rar;
| C:\project\libs\seam-hibernate\bootstrap\deploy\jboss-xa-jdbc.rar;
| C:\project\libs\seam-hibernate\bootstrap\deploy\jms-ra.rar;
| C:\project\libs\seam-hibernate\bootstrap\deploy\messaging\connection-factories-service.xml;
| C:\project\libs\seam-hibernate\bootstrap\deploy\messaging\destinations-service.xml;
| C:\project\libs\seam-hibernate\bootstrap\deploy\messaging\hsqldb-persistence-service.xml;
| C:\project\libs\seam-hibernate\bootstrap\deploy\messaging\jms-ds.xml;
| C:\project\libs\seam-hibernate\bootstrap\deploy\messaging\legacy-service.xml;
| C:\project\libs\seam-hibernate\bootstrap\deploy\messaging\messaging-service.xml;
| C:\project\libs\seam-hibernate\bootstrap\deploy\messaging\remoting-service.xml;
| C:\project\libs\seam-hibernate\bootstrap\deploy\remoting-service.xml;
| C:\project\libs\seam-hibernate\bootstrap\deployers\aspect-deployer-beans.xml;
| C:\project\libs\seam-hibernate\bootstrap\deployers\ejb3-deployers-beans.xml;
| C:\project\libs\seam-hibernate\bootstrap\deployers\jca-deployers-beans.xml;
| C:\project\libs\seam-hibernate\bootstrap\jndi.properties;
| C:\project\libs\seam-hibernate\bootstrap\log4j.xml;
| C:\project\libs\seam-hibernate\bootstrap\readme.txt;
You've already got bootstrap on the classpath, not needed
anonymous wrote : C:\project\libs\seam-hibernate\cglib-nodep.jar;
| C:\project\libs\seam-hibernate\cglib.jar;
| C:\project\libs\seam-hibernate\core.jar;
| C:\project\libs\seam-hibernate\dom4j.jar;
| C:\project\libs\seam-hibernate\ejb-api.jar;
| C:\project\libs\seam-hibernate\ejb3-persistence.jar;
| C:\project\libs\seam-hibernate\gwt-servlet.jar;
anonymous wrote : C:\project\libs\seam-hibernate\hibernate-annotations.jar;
| C:\project\libs\seam-hibernate\hibernate-commons-annotations.jar;
| C:\project\libs\seam-hibernate\hibernate-entitymanager.jar;
| C:\project\libs\seam-hibernate\hibernate-search.jar;
| C:\project\libs\seam-hibernate\hibernate-validator.jar;
| C:\project\libs\seam-hibernate\hibernate.jar;
Already got hibernate from hibernate-all.jar
anonymous wrote : C:\project\libs\seam-hibernate\itext.jar;
| C:\project\libs\seam-hibernate\janino.jar;
| C:\project\libs\seam-hibernate\javassist.jar;
| C:\project\libs\seam-hibernate\jaxb-api.jar;
| C:\project\libs\seam-hibernate\jaxws-api.jar;
| C:\project\libs\seam-hibernate\jboss-aop.jar;
| C:\project\libs\seam-hibernate\jboss-archive-browsing.jar;
| C:\project\libs\seam-hibernate\jboss-cache.jar;
| C:\project\libs\seam-hibernate\jboss-common-core.jar;
| C:\project\libs\seam-hibernate\jboss-container.jar;
| C:\project\libs\seam-hibernate\jboss-dependency.jar;
| C:\project\libs\seam-hibernate\jboss-el.jar;
| C:\project\libs\seam-hibernate\jboss-jmx.jar;
| C:\project\libs\seam-hibernate\jboss-kernel.jar;
| C:\project\libs\seam-hibernate\jboss-logging-spi.jar;
| C:\project\libs\seam-hibernate\jboss-seam-debug.jar;
| C:\project\libs\seam-hibernate\jboss-seam-gen.jar;
| C:\project\libs\seam-hibernate\jboss-seam-ioc.jar;
| C:\project\libs\seam-hibernate\jboss-seam-mail.jar;
| C:\project\libs\seam-hibernate\jboss-seam-pdf.jar;
| C:\project\libs\seam-hibernate\jboss-seam-remoting.jar;
| C:\project\libs\seam-hibernate\jboss-seam-ui.jar;
| C:\project\libs\seam-hibernate\jboss-seam.jar;
| C:\project\libs\seam-hibernate\jboss-system.jar;
| C:\project\libs\seam-hibernate\jbossxb.jar;
| C:\project\libs\seam-hibernate\jbpm-jpdl.jar;
| C:\project\libs\seam-hibernate\jcommon.jar;
| C:\project\libs\seam-hibernate\jfreechart.jar;
| C:\project\libs\seam-hibernate\jgroups.jar;
| C:\project\libs\seam-hibernate\jms.jar;
| C:\project\libs\seam-hibernate\jta.jar;
| C:\project\libs\seam-hibernate\log4j.jar;
| C:\project\libs\seam-hibernate\lucene-core.jar;
| C:\project\libs\seam-hibernate\mail-ra.jar;
| C:\project\libs\seam-hibernate\mail.jar;
| C:\project\libs\seam-hibernate\meldware-mailapi.jar;
| C:\project\libs\seam-hibernate\meldware-mailjmx.jar;
| C:\project\libs\seam-hibernate\mvel14.jar;
| C:\project\libs\seam-hibernate\persistence-api.jar;
| C:\project\libs\seam-hibernate\portlet-api.jar;
| C:\project\libs\seam-hibernate\quartz.jar;
| C:\project\libs\seam-hibernate\urlrewritefilter.jar;
| C:\project\libs\testing\jmock\cglib-2.1_3-src.jar;
| C:\project\libs\testing\jmock\cglib-nodep-2.1_3.jar;
| C:\project\libs\testing\jmock\hamcrest-core-1.1.jar;
| C:\project\libs\testing\jmock\hamcrest-library-1.1.jar;
| C:\project\libs\testing\jmock\jmock-2.4.0.jar;
| C:\project\libs\testing\jmock\jmock-junit4-2.4.0.jar;
| C:\project\libs\testing\jmock\jmock-legacy-2.4.0.jar;
| C:\project\libs\testing\jmock\objenesis-1.0.jar;
| C:\project\model\dist\project-model-test.jar'
| 'org.testng.TestNG'
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111371#4111371
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111371
18 years, 4 months