[jboss-user] [JBoss Portal] - Wrong tx on thread in UserModule

HerQpapa do-not-reply at jboss.com
Fri Mar 28 10:20:20 EDT 2008


Hi,

I am using jboss-portal-2.6.2.GA in cygwin env, MySQL backend.

I have the following method which I use to check whether a user already exists:

  | public User findUserByUserName(String userName) throws IdentityException{
  |     try {
  |       UserTransaction ut = (UserTransaction) (new InitialContext()
  | 	.lookup("java:comp/UserTransaction"));
  |       ut.begin();
  |       User user = ((UserModule) (new InitialContext() ).lookup("java:/portal/UserModule")).findUserByUserName(userName);
  |      ut.commit();
  |      return user;
  |     } catch (NamingException ex) {
  |       ex.printStackTrace();
  |     } catch (NotSupportedException ex) {
  |       ex.printStackTrace();
  |     } catch (SystemException ex) {
  |       ex.printStackTrace();
  |     } catch (SecurityException ex) {
  |       ex.printStackTrace();
  |     } catch (IllegalStateException ex) {
  |       ex.printStackTrace();
  |     } catch (RollbackException ex) {
  |       ex.printStackTrace();
  |     } catch (HeuristicMixedException ex) {
  |       ex.printStackTrace();
  |     } catch (HeuristicRollbackException ex) {
  |       ex.printStackTrace();
  |     } catch (IllegalArgumentException ex) {
  |       System.out.println("3333B");
  |       ex.printStackTrace();
  |     } 
  |     return null;
  |   }
  | 

If user does not exists I get the following Exception:


  | 2008-03-28 14:02:20,202 ERROR [org.jboss.portal.server.servlet.PortalServlet] Unexpected exception
  | java.lang.IllegalStateException: Wrong tx on thread: expected TransactionImple < ac, BasicAction: a28778f:719:47ecf96c:27c status: ActionStatus.ABORT_ONLY >, actual TransactionImple < ac, BasicAction: a28778f:719:47ecf96c:285 status: ActionStatus.RUNNING >
  | 	at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:162)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
  | 	at org.jboss.aspects.tx.TxInterceptor$RequiresNew.invoke(TxInterceptor.java:262)
  | 	at org.jboss.portal.core.aspects.server.TransactionInterceptor$invoke_N5143606530999904530.invokeNext(TransactionInterceptor$invoke_N5143606530999904530.java)
  | 	at org.jboss.portal.core.aspects.server.TransactionInterceptor.invoke(TransactionInterceptor.java)
  | 	at org.jboss.portal.server.ServerInterceptor.invoke(ServerInterceptor.java:38)
  | 	at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115)
  | 	at org.jboss.portal.server.aspects.LockInterceptor$InternalLock.invoke(LockInterceptor.java:70)
  | 	at org.jboss.portal.server.aspects.LockInterceptor.invoke(LockInterceptor.java:131)
  | 	at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115)
  | 	at org.jboss.portal.common.invocation.Invocation.invoke(Invocation.java:157)
  | 	at org.jboss.portal.server.servlet.PortalServlet.service(PortalServlet.java:380)
  | 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  | 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  | 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
  | 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  | 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
  | 	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
  | 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
  | 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
  | 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
  | 	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
  | 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  | 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
  | 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
  | 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
  | 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
  | 	at java.lang.Thread.run(Thread.java:595)
  | 2008-03-28 14:02:20,202 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/portal].[PortalServletWithPathMapping]] Servlet.service() for servlet PortalServletWithPathMapping threw exception
  | java.lang.IllegalStateException: Wrong tx on thread: expected TransactionImple < ac, BasicAction: a28778f:719:47ecf96c:27c status: ActionStatus.ABORT_ONLY >, actual TransactionImple < ac, BasicAction: a28778f:719:47ecf96c:285 status: ActionStatus.RUNNING >
  | 	at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:162)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
  | 	at org.jboss.aspects.tx.TxInterceptor$RequiresNew.invoke(TxInterceptor.java:262)
  | 	at org.jboss.portal.core.aspects.server.TransactionInterceptor$invoke_N5143606530999904530.invokeNext(TransactionInterceptor$invoke_N5143606530999904530.java)
  | 	at org.jboss.portal.core.aspects.server.TransactionInterceptor.invoke(TransactionInterceptor.java)
  | 	at org.jboss.portal.server.ServerInterceptor.invoke(ServerInterceptor.java:38)
  | 	at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115)
  | 	at org.jboss.portal.server.aspects.LockInterceptor$InternalLock.invoke(LockInterceptor.java:70)
  | 	at org.jboss.portal.server.aspects.LockInterceptor.invoke(LockInterceptor.java:131)
  | 	at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115)
  | 	at org.jboss.portal.common.invocation.Invocation.invoke(Invocation.java:157)
  | 	at org.jboss.portal.server.servlet.PortalServlet.service(PortalServlet.java:380)
  | 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  | 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  | 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
  | 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  | 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
  | 	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
  | 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
  | 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
  | 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
  | 	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
  | 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  | 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
  | 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
  | 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
  | 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
  | 	at java.lang.Thread.run(Thread.java:595)
  | 2008-03-28 14:02:20,264 ERROR [org.jboss.web.tomcat.service.jca.CachedConnectionValve] Application error: PortalServletWithPathMapping did not complete its transaction
  | 

Even though I catch the IdentityException my page is not rendered again, but has the following output:


  | HTTP Status 500 -
  | type Exception report
  | message
  | description The server encountered an internal error () that prevented it from fulfilling this request.
  | exception 
  | javax.servlet.ServletException: java.lang.IllegalStateException: Wrong tx on thread: expected TransactionImple < ac, BasicAction: a28778f:719:47ecf96c:27c status: ActionStatus.ABORT_ONLY >, actual TransactionImple < ac, BasicAction: a28778f:719:47ecf96c:285 status: ActionStatus.RUNNING >
  | org.jboss.portal.server.servlet.PortalServlet.service(PortalServlet.java:406)
  | 	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | root cause
  | java.lang.IllegalStateException: Wrong tx on thread: expected TransactionImple < ac, BasicAction: a28778f:719:47ecf96c:27c status: ActionStatus.ABORT_ONLY >, actual TransactionImple < ac, BasicAction: a28778f:719:47ecf96c:285 status: ActionStatus.RUNNING >
  | 	org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:162)
  | 	org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)	org.jboss.aspects.tx.TxInterceptor$RequiresNew.invoke(TxInterceptor.java:262)	org.jboss.portal.core.aspects.server.TransactionInterceptor$invoke_N5143606530999904530.invokeNext(TransactionInterceptor$invoke_N5143606530999904530.java)	org.jboss.portal.core.aspects.server.TransactionInterceptor.invoke(TransactionInterceptor.java)	org.jboss.portal.server.ServerInterceptor.invoke(ServerInterceptor.java:38)	org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115)	org.jboss.portal.server.aspects.LockInterceptor$InternalLock.invoke(LockInterceptor.java:70)	org.jboss.portal.server.aspects.LockInterceptor.invoke(LockInterceptor.java:131)	org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115)	org.jboss.portal.common.invocation.Invocation.invoke(Invocation.java:157)	org.jboss.portal.server.servlet.PortalServlet.service(PortalServlet.java:380)
  | 	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | note The full stack trace of the root cause is available in the JBossWeb/2.0.0.GA logs.
  | 
I found this JIRA http://jira.jboss.com/jira/browse/JBPORTAL-1315 but I think it is a different problem although might be the same issue.

Anybody any idea how to work around? Or how to check without exception if a user exists?

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

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



More information about the jboss-user mailing list