Mantis - Resin
Viewing Issue Advanced Details
2559 minor always 03-28-08 07:43 03-28-08 15:46
ferg  
ferg  
normal  
closed 3.1.5  
fixed  
none    
none 3.1.6  
0002559: EJB/setRollbackOnly
(rep by Carljohan Carlsson)

Im trying to set up CMT with EJB (resin 3.1.5) and running into some
problems when rolling back a transaction.

Any ideas?

/Carljohan

EJB:

@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
public class UserServiceImpl extends GenericService implements UserService {

..

@TransactionAttribute(TransactionAttributeType.REQUIRED)
   public Group saveGroup(Group g) {

if(...) {
           LOG.warn("Rolling back transaction");
           sessionContext.setRollbackOnly();
}

}

Log:
[18:09:23.285] {http--8080-1} Transaction[01:0dac5463] begin
[18:09:23.285] {http--8080-1} Transaction[01:0dac5463] rollback-only:
java.lang.IllegalStateException: invalid transaction
[18:09:23.285] {http--8080-1} Transaction[01:0dac5463] rollback-only:
java.lang.IllegalStateException: invalid transaction
[18:09:23.285] {http--8080-1} Transaction[01:0dac5463] rollback
[18:09:23.285] {http--8080-1} javax.servlet.ServletException:
javax.ejb.TransactionRolledbackLocalException:
java.lang.IllegalStateException: invalid transaction
[18:09:23.285] {http--8080-1} at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
[18:09:23.285] {http--8080-1} at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
[18:09:23.285] {http--8080-1} at
com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87)
[18:09:23.285] {http--8080-1} at
com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:181)
[18:09:23.285] {http--8080-1} at
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
[18:09:23.285] {http--8080-1} at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:269)
[18:09:23.285] {http--8080-1} at
com.caucho.server.port.TcpConnection.run(TcpConnection.java:603)
[18:09:23.285] {http--8080-1} at
com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721)
[18:09:23.285] {http--8080-1} at
com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643)
[18:09:23.285] {http--8080-1} at
java.lang.Thread.run(Thread.java:595)
[18:09:23.285] {http--8080-1} Caused by:
javax.ejb.TransactionRolledbackLocalException:
java.lang.IllegalStateException: invalid transaction
[18:09:23.285] {http--8080-1} at
com.caucho.ejb3.xa.XAManager.commit(XAManager.java:247)
[18:09:23.285] {http--8080-1} at
_ejb.UserServiceImpl.UserServiceImpl__EJB$UserService__Bean.addUser(UserServiceImpl__EJB.java:122)
[18:09:23.285] {http--8080-1} at
_ejb.UserServiceImpl.UserServiceImpl__EJB$UserService__EJBLocal.addUser(UserServiceImpl__EJB.java:354)

...

[18:09:23.285] {http--8080-1} Caused by:
com.caucho.transaction.RollbackExceptionWrapper:
java.lang.IllegalStateException: invalid transaction
[18:09:23.285] {http--8080-1} at
com.caucho.transaction.TransactionImpl.commit(TransactionImpl.java:579)
[18:09:23.285] {http--8080-1} at
com.caucho.transaction.TransactionManagerImpl.commit(TransactionManagerImpl.java:271)
[18:09:23.285] {http--8080-1} at
com.caucho.jca.UserTransactionImpl.commit(UserTransactionImpl.java:417)
[18:09:23.285] {http--8080-1} at
com.caucho.jca.UserTransactionProxy.commit(UserTransactionProxy.java:148)
[18:09:23.285] {http--8080-1} at
com.caucho.ejb3.xa.XAManager.commit(XAManager.java:243)
[18:09:23.285] {http--8080-1} ... 111 more
[18:09:23.285] {http--8080-1} Caused by:
java.lang.IllegalStateException: invalid transaction
[18:09:23.285] {http--8080-1} at
com.caucho.ejb.AbstractContext.setRollbackOnly(AbstractContext.java:322)
[18:09:23.285] {http--8080-1} at
com.stendahls.ddt.logic.UserServiceImpl.saveGroup(UserServiceImpl.java:104)
[18:09:23.285] {http--8080-1} at
_ejb.UserServiceImpl.UserServiceImpl__EJB$UserService__Bean.saveGroup(UserServiceImpl__EJB.java:198)
[18:09:23.285] {http--8080-1} at
com.stendahls.ddt.logic.UserServiceImpl.addUser(UserServiceImpl.java:73)
[18:09:23.285] {http--8080-1} at
_ejb.UserServiceImpl.UserServiceImpl__EJB$UserService__Bean.addUser(UserServiceImpl__EJB.java:116)
[18:09:23.285] {http--8080-1} ... 110 more



Notes
(0002930)
ferg   
03-28-08 15:46   
ejb/0f1d