[jboss-user] [JBoss AOP] - Re: Call to Stateless Session Bean within interceptor ends t

c.greshake do-not-reply at jboss.com
Fri Oct 20 04:15:29 EDT 2006


Hi Gareth,

since RC7 i have the same problem. Have you solved it? 

"garethevans" wrote : Hi,
  | 
  | I have an issue regarding an transaction ending to early that i believe is caused by jbossaop.  My setup is JBossAS4.0.4, JBossAOP and JBossWS1.0.1.   The problem is that I am applying an interceptor around a method within a stateless session bean as marked by an annotation (RequiresLogin)
  | 
  | e.g.
  | 
  | 
  |   | @Stateless
  |   | public class UserService {
  |   |     @RequiresLogin // my custom annotation
  |   |     public List<User> getAllUsers() ....
  |   | }
  |   | 
  | 
  | The interceptor looks like
  | 
  | 
  |   | public LoginInterceptor implements Interceptor {
  |   |     public Object invoke(Invocation invocation) throws Throwable {
  |   |          String sessionIdentifier = // get session id from method args
  |   |          HandheldService handheldService = // lookup handheld service
  |   |          boolean isLoggedIn = handheldService.checkLogin( sessionIdentifier );
  |   |          // handle if not logged in
  |   | 
  |   |          return invocation.invokeNext();
  |   |     }
  |   | }
  |   | 
  | 
  | The call to handheldService.checkLogin works correctly but I am presuming that when the method completes then the transaction is closed and when the call to getAllUsers is made that the transaction does not exist?
  | 
  | The exception that is thrown is as follows:
  | 
  | 
  | 11:17:48,502 WARN  [JDBCExceptionReporter] SQL Error: 0, SQLState: null
  |   | 11:17:48,502 ERROR [JDBCExceptionReporter] Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=susannew.msoft.dev/17, BranchQual=, lo
  |   | calId=17]; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=susannew.msoft.
  |   | dev/17, BranchQual=, localId=17])
  |   | 11:17:48,510 ERROR [SOAPFaultExceptionHelper] SOAP request exception
  |   | javax.ejb.EJBTransactionRolledbackException: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
  |   |         at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:93)
  |   |         at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
  |   |         at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:201)
  |   |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |   |         at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
  |   | 
  |   | ....
  |   | 
  |   | Caused by: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=susannew.msoft.dev/17, BranchQual=,
  |   |  localId=17]; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=susannew.mso
  |   | ft.dev/17, BranchQual=, localId=17])
  |   |         at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)
  |   |         at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
  |   |         at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
  |   |         ... 109 more
  |   | Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=susannew.msoft.dev/17, BranchQual=,
  |   | localId=17]
  |   |         at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:290)
  |   |         at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:379)
  |   |         at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:812)
  |   | 
  |   | 
  | 
  | If i comment out the interceptor call to checkLogin every thing works as expected!
  | 
  | Any Ideas, 
  | 
  | Thanks Gareth

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3979579#3979579

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3979579



More information about the jboss-user mailing list