wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes TransactionRolledBack Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "TransactionRolledBack Exception" Watch "TransactionRolledBack Exception" New topic
Author

TransactionRolledBack Exception

wandy bailey
Greenhorn

Joined: Nov 15, 2006
Posts: 2
Hi,

I have a stateless session bean class, getAllItems(), which talks to the entity bean in order to display all items from a database table.
I tried testing the method from client java program, after a while trying to retrieve around 200 of 1000 data from the database i get the TransactionRolledBack exception, somewhere inside the ejbLoad() method, I think.

Stateless -- TestService:
getAllItems(){
Enumeration testEnum = testHome.findAll();
while (testEnum.hasmoreElement()) {
Test oneTest = (Test) testEnum.nextElement();
System.out.println(oneTest.getId());
}

ejbCreate(){
//getHomeFactory
//lookup home for testHome
}

ejbPostCreate(){
// nothing
}
Im using jboss+postgresql db, BMP persistance type, I put postgres-ds.xml in the /default/deploy directory (I used the default postgres-ds.xml default w/ the following datasources attribute):

<local-tx-datasource>
<jndi-name></jndi-name>
<connection-url></connection-url>
<driver-class></driver-class>
<user-name></user-name>
<password></password>
</local-tx-datasource>

The stack trace is the following:
-------------------------
10:20:05,132 WARN [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=WWANDY/15, BranchQual=, localId=15] timed out. status=STATUS_ACTIVE
10:20:05,851 ERROR [LogInterceptor] TransactionRolledbackException in method: public abstract java.lang.String Test.getId() throws java.rmi.RemoteException, causedBy:
javax.transaction.RollbackException: Already marked for rollback TransactionImpl:XidImpl[FormatId=257, GlobalId=WWANDY/15, BranchQual=, localId=15]
at org.jboss.tm.TransactionImpl.registerSynchronization(TransactionImpl.java:635)
at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.register(EntitySynchronizationInterceptor.java:160)
at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:280)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:126)
at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:276)
at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:104)
at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:68)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:520)
at org.jboss.ejb.Container.invoke(Container.java:954)
at sun.reflect.GeneratedMethodAccessor72.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:206)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:192)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:112)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
at $Proxy60.getId(Unknown Source)
at service.TestServiceBean.getAllItems()(TestServiceBean.java:49)
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.jboss.invocation.Invocation.performCall(Invocation.java:359)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
at org.jboss.ws.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:64)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
at org.jboss.ejb.Container.invoke(Container.java:954)
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.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
--------------------------

If I do 'testHome.findAll()', then do business methods from client java directly (skipping the stateless bean), it retrieves ALL data from db everytime. This led me to believe this is stateless bean problem?? instead of db connection??? Im at lost here....
Any help is appreciated.

Thanks,
motl3y
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425

10:20:05,132 WARN [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=WWANDY/15, BranchQual=, localId=15] timed out. status=STATUS_ACTIVE


the transactionrollback exception is due to timeout. Stack trace also shows that exception occurred on getId() method. I am not sure if postgresql has locked a row or table (for reading). Have you configure transaction attribute for the BMP bean? What's the transaction context for getId() method.
[ November 15, 2006: Message edited by: Purushothaman Thambu ]
wandy bailey
Greenhorn

Joined: Nov 15, 2006
Posts: 2
Hi,

thanks for the reply...
"Have you configure transaction attribute for the BMP bean? What's the transaction context for getId() method."

I'm pretty new to the whole concept of ejb... No, i didn't set any transactional attribute on the deployment desc. Nor did I put any transaction context on any of the business methods. Im gonna do more research on this before reposting. Thanks
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

"motl3y",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with display names get deleted.


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
S Vishnu
Greenhorn

Joined: Jan 21, 2007
Posts: 1
Hi

I am getting the below error when i try to use the stateless session bean.

message <font face='Verdana, Arial, Helvetica' size='2'>Sorry, an error has occurred: null</font><br><br><font face='Verdana, Arial, Helvetica' size='1'>com.tlc.report.ReportException<br> at com.tlc.report.ReportBean.load(ReportBean.java:1087)<br> at com.tlc.report.ReportBean.load(ReportBean.java:1244)<br> at sun.reflect.GeneratedMethodAccessor160.invoke(Unknown Source)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br> at java.lang.reflect.Method.invoke(Method.java:585)<br> at org.jboss.invocation.Invocation.performCall(Invocation.java:359)<br> at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)<br> at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)<br> at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)<br> at org.jboss.ws.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:64)<br> at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)<br> at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)<br> at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)<br> at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)<br> at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)<br> at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)<br> at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)<br> at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)<br> at org.jboss.ejb.Container.invoke(Container.java:954)<br> at sun.reflect.GeneratedMethodAccessor125.invoke(Unknown Source)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br> at java.lang.reflect.Method.invoke(Method.java:585)<br> at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)<br> at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)<br> at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)<br> at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)<br> at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)<br> at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)<br> at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)<br> at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:206)<br> at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:192)<br> at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)<br> at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)<br> at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)<br> at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)<br> at $Proxy106.load(Unknown Source)<br> at com.tlc.isupport.ISupport.reportCaseLogged(ISupport.java:503)<br> at com.tlc.isupport.ISupport.service(ISupport.java:219)<br> at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)<br> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)<br> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)<br> at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)<br> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)<br> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)<br> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)<br> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)<br> at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)<br> at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)<br> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)<br> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)<br> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)<br> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)<br> at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)<br> at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)<br> at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754)<br> at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684)<br> at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876)<br> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)<br> at java.lang.Thread.run(Thread.java:595)</font>

This error does not come for the first time , it comes after subsequent calls to the Reportbean

Somebody please help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TransactionRolledBack Exception
 
Similar Threads
Integrating Hibernate with EJB
Transaction problem
Entity Beans (CMP) with PostGis
session.save(Object myPojo) is not working
Problem when a CMP-finder gets to much results