2 Replies Latest reply on May 10, 2006 5:43 AM by Mustafa Egilmezbilek

    RollbackException on Validation

    Mustafa Egilmezbilek Newbie

      I am trying to use seam-1.0.0.CR2 on jboss-4.0.4.CR2.

      I started to get RollbackException when I enter invalid data into my form. From docs what I read was the validation takes place before a method body gets executed. I am in a difficult position to understand how I do get a RollbackException.

      I included my stack trace, entity(OdaTipleri), and seam component(OdaTipleriEditorBean):

      2006-05-09 16:02:55,781 ERROR [org.jboss.seam.servlet.SeamExceptionFilter] uncaught exception handled by Seam
      javax.servlet.ServletException: Error calling action method of component with id _id2:_id20
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:44)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:595)
      2006-05-09 16:02:55,796 DEBUG [org.jboss.seam.util.NamingHelper] JNDI InitialContext properties:{}
      2006-05-09 16:02:55,796 INFO [org.jboss.seam.servlet.SeamExceptionFilter] killing transaction
      2006-05-09 16:02:55,796 DEBUG [org.jboss.seam.util.NamingHelper] JNDI InitialContext properties:{}
      2006-05-09 16:02:55,796 DEBUG [org.hibernate.jdbc.JDBCContext] TransactionFactory reported no active transaction; Synchronization not registered
      2006-05-09 16:02:55,796 DEBUG [org.hibernate.jdbc.JDBCContext] TransactionFactory reported no active transaction; Synchronization not registered
      2006-05-09 16:02:55,796 DEBUG [org.jboss.seam.contexts.Lifecycle] After request, destroying contexts
      2006-05-09 16:02:55,796 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing business process context
      2006-05-09 16:02:55,796 DEBUG [org.jboss.seam.contexts.BusinessProcessContext] no process instance to persist business process state
      2006-05-09 16:02:55,796 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying event context
      2006-05-09 16:02:55,796 DEBUG [org.jboss.seam.contexts.Contexts] destroying: org.jboss.seam.core.manager
      2006-05-09 16:02:55,796 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying conversation context
      2006-05-09 16:02:55,796 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing server-side conversation context
      2006-05-09 16:02:55,796 DEBUG [org.jboss.seam.contexts.Lifecycle] <<< End web request
      2006-05-09 16:02:55,796 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/seamapp].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
      javax.faces.FacesException: Error calling action method of component with id _id2:_id20
      at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
      at javax.faces.component.UICommand.broadcast(UICommand.java:106)
      at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
      at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
      at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
      at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:44)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.faces.el.EvaluationException: Exception while invoking expression #{odatipleriEditor.create}
      at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
      at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
      ... 28 more
      Caused by: java.lang.RuntimeException: javax.transaction.RollbackException: Already marked for rollback TransactionImpl:XidImpl[FormatId=257, GlobalId=BLACKSHEEP/29, BranchQual=, localId=29]
      at org.jboss.ejb3.stateful.StatefulBeanContext.remove(StatefulBeanContext.java:270)
      at org.jboss.ejb3.AbstractPool.remove(AbstractPool.java:171)
      at org.jboss.ejb3.cache.simple.SimpleStatefulCache.remove(SimpleStatefulCache.java:284)
      at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:89)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:199)
      at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
      at $Proxy180.create(Unknown Source)
      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.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
      ... 29 more
      Caused by: javax.transaction.RollbackException: Already marked for rollback TransactionImpl:XidImpl[FormatId=257, GlobalId=BLACKSHEEP/29, BranchQual=, localId=29]
      at org.jboss.tm.TransactionImpl.registerSynchronization(TransactionImpl.java:632)
      at org.jboss.ejb3.stateful.StatefulBeanContext.remove(StatefulBeanContext.java:257)
      ... 47 more


      I have an entity OdaTipleri as follows:
      @Entity
      @Table(name="oda_tipleri")
      public class OdaTipleri implements java.io.Serializable {
      // Fields
      private int odaTipNo;
      private String odaTipTanimi;
      private String odaTipKodu;
      private int kapasite;

      // Constructors
      /** default constructor */
      public OdaTipleri() {
      }

      @Id @GeneratedValue
      @Column(name="Oda_Tip_No")
      public int getOdaTipNo() {
      return this.odaTipNo;
      }
      public void setOdaTipNo(int odaTipNo) {
      this.odaTipNo = odaTipNo;
      }

      @NotNull @Length(min=1, max=100)
      @Column(name="Oda_Tip_Tanimi")
      public String getOdaTipTanimi() {
      return this.odaTipTanimi;
      }
      public void setOdaTipTanimi(String odaTipTanimi) {
      this.odaTipTanimi = odaTipTanimi;
      }

      @NotNull @Length(min=1, max=10)
      @Column(name="Oda_Tip_Kodu")
      public String getOdaTipKodu() {
      return this.odaTipKodu;
      }
      public void setOdaTipKodu(String odaTipKodu) {
      this.odaTipKodu = odaTipKodu;
      }

      @NotNull @Range(min=1, max=10)
      @Column(name="Kapasite")
      public int getKapasite() {
      return this.kapasite;
      }
      public void setKapasite(int kapasite) {
      this.kapasite = kapasite;
      }
      }


      And my Seam component OdaTipleriEditorBean:

      @Name("odatipleriEditor")
      @Stateful
      @Interceptors(SeamInterceptor.class)
      public class OdaTipleriEditorBean implements OdaTipleriEditor {

      @PersistenceContext(type = EXTENDED)
      private EntityManager entityManager;

      @Valid
      private OdaTipleri instance = new OdaTipleri();

      private boolean isNew = true;

      private String doneOutcome = "find";

      @In(required = false)
      private transient OdaTipleriFinder odatipleriFinder;

      @In
      private transient ResourceBundle resourceBundle;

      @TransactionAttribute(NOT_SUPPORTED)
      public OdaTipleri getInstance() {
      return instance;
      }
      public void setInstance(OdaTipleri instance) {
      this.instance = instance;
      }

      @TransactionAttribute(NOT_SUPPORTED)
      public boolean isNew() {
      return isNew;
      }
      public void setNew(boolean isNew) {
      this.isNew = isNew;
      }

      public void setDoneOutcome(String outcome) {
      doneOutcome = outcome;
      }

      @Begin(join = true)
      @IfInvalid(outcome = Outcome.REDISPLAY, refreshEntities=true)
      public String create() {
      if( isNew ) {
      if( !odatipleriFinder.isValid( instance ) ) {
      FacesContext.getCurrentInstance().addMessage(null,
      new FacesMessage( resourceBundle.getString("AlreadyExists") ) );
      return null;
      }
      entityManager.persist(instance);
      isNew = false;
      } else {
      entityManager.merge(instance);
      }
      return "editOdaTipleri";
      }

      @IfInvalid(outcome = Outcome.REDISPLAY)
      public String update() {
      refreshFinder();
      return null;
      }

      @Begin(join = true)
      public String select() {
      setInstance(odatipleriFinder.getSelection());
      setNew(false);
      return "editOdaTipleri";
      }

      @End(ifOutcome = "find")
      public String done() {
      refreshFinder();
      return doneOutcome;
      }

      @End(ifOutcome = "find")
      public String cancel() {
      refreshFinder();
      return doneOutcome;
      }

      @End(ifOutcome = "find")
      public String delete() {
      entityManager.remove(instance);
      entityManager.flush();
      refreshFinder();
      return doneOutcome;
      }

      private void refreshFinder() {
      if (odatipleriFinder != null)
      odatipleriFinder.refresh();
      }

      @Destroy
      @Remove
      public void destroy() {
      }
      }

      Any help, link or pointer will be highly appreciated.