1 2 Previous Next 22 Replies Latest reply on Nov 24, 2011 3:30 PM by lightguard

    Applied Transactional on a view action will cause excption...

    hantsy

      I want to load Message via viewAction and ...update the view Status of the message, so I added a Transacational on the load method.


      @Named("messageAction")
      @RequestScoped
      public class MessageAction {
      
           private static final Logger log = LoggerFactory
                     .getLogger(MessageAction.class);
           @Inject
           EntityManager em;
      
           @Inject
           @Authenticated
           UserAccount currentUser;
      
           private Long messageId;
      
           private Message currentMessage;
      
           public Long getMessageId() {
                return messageId;
           }
      
           public void setMessageId(Long messageId) {
                this.messageId = messageId;
           }
      
           public Message getCurrentMessage() {
                return currentMessage;
           }
      
           public void setCurrentMessage(Message currentMessage) {
                this.currentMessage = currentMessage;
           }
      
           @Transactional
           public void load() {
                if (log.isDebugEnabled()) {
                     log.debug("call load...");
                }
      
                this.currentMessage = em.find(Message.class, this.messageId);
                this.currentMessage.addReadStatus(currentUser, new MessageReadStatus(
                          this.currentMessage, currentUser, new Date()));
                this.currentMessage = em.merge(this.currentMessage);
           }
      }
      
      



      It will throw exception.


      java.lang.IllegalStateException: Could not commit transaction
           at org.jboss.seam.faces.transaction.TransactionPhaseListener.commitOrRollback(TransactionPhaseListener.java:137)
           at org.jboss.seam.faces.transaction.TransactionPhaseListener.commitOrRollback(TransactionPhaseListener.java:116)
           at org.jboss.seam.faces.transaction.TransactionPhaseListener.handleTransactionsAfterPhase(TransactionPhaseListener.java:94)
           at org.jboss.seam.faces.transaction.TransactionPhaseListener.afterPhase(TransactionPhaseListener.java:71)
           at org.jboss.seam.faces.event.DelegatingPhaseListener.afterPhase(DelegatingPhaseListener.java:51)
           at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)
           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
           at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
           at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
           at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
           at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
           at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139)
           at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)
           at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952)
           at java.lang.Thread.run(Thread.java:662)
      Caused by: javax.transaction.RollbackException: Could not commit transaction.
           at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1171)
           at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:119)
           at org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:61)
           at org.jboss.seam.transaction.DefaultSeamTransaction.commit(DefaultSeamTransaction.java:91)
           at org.jboss.seam.faces.transaction.TransactionPhaseListener.commitOrRollback(TransactionPhaseListener.java:124)
           ... 35 more
      Caused by: javax.persistence.PersistenceException: error during managed flush
           at org.hibernate.ejb.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1459)
           at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:109)
           at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:54)
           at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:97)
           at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:274)
           at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:94)
           at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:159)
           at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1159)
           ... 39 more
      Caused by: javax.validation.ConstraintViolationException: Validation failed for classes [com.telopsys.siorc.model.Message] during update time for groups [javax.validation.groups.Default, ]
      List of constraint violations:[
           ConstraintViolationImpl{interpolatedMessage='不能为空', propertyPath=messageId, rootBeanClass=class com.telopsys.siorc.model.Message, messageTemplate='{org.hibernate.validator.constraints.NotEmpty.message}'}
      ]
           at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.validate(BeanValidationEventListener.java:158)
           at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.onPreUpdate(BeanValidationEventListener.java:101)
           at org.hibernate.action.internal.EntityUpdateAction.preUpdate(EntityUpdateAction.java:200)
           at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:88)
           at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:273)
           at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:265)
           at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:187)
           at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:336)
           at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
           at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1073)
           at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:318)
           at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:104)
           ... 45 more
      

        • 1. Re: Applied Transactional on a view action will cause excption...
          hantsy

          But if I removed the updating code and remove the Transactional annotation...it works.


                  //@Transactional
                  public void load() {
                          if (log.isDebugEnabled()) {
                                  log.debug("call load...");
                          }
          
                          this.currentMessage = em.find(Message.class, this.messageId);
          //              this.currentMessage.addReadStatus(currentUser, new MessageReadStatus(
          //                              this.currentMessage, currentUser, new Date()));
          //              this.currentMessage = em.merge(this.currentMessage);
                  }
          



          I also tried to add INVOKE_APPLICATION phase in the viewAction, and got the same exception above.


          • 2. Re: Applied Transactional on a view action will cause excption...
            hantsy
            • 3. Re: Applied Transactional on a view action will cause excption...
              hantsy

              I have tried to use PreRenderViewEvent instead...it works.


              So I think this is a bug of Seam faces and seam transaction.

              • 4. Re: Applied Transactional on a view action will cause excption...
                lightguard

                If you're coming through via a JSF request, with Seam Faces and Seam Transaction on the classpath, every request is already wrapped in a transaction.

                • 5. Re: Applied Transactional on a view action will cause excption...
                  hantsy

                  Of course, the seam faces and seam transaction in my project classpath...I also know every request is wrapped in a transaction.


                  But I encountered the transaction exception.


                  When I replace the viewAction with f:event(preRenderView), it works.


                  OK, I paste more about the related codes here.


                  The following is the code entering the message view.


                  <h:link outcome="/messaging/message" value="#{messages['Buttons.View']}">
                       <f:param name="id" value="#{obj.id}"></f:param>
                  </h:link>
                  



                  The message view metadata code.


                            <f:metadata>
                                 <f:viewParam name="id" value="#{messageAction.messageId}" />
                                 <s:viewAction action="#{messageAction.load}" />
                                 
                            </f:metadata>
                  



                  The messageAction I have posted above.



                  It will throw the transaction exception.



                  When I replaced the metadata with the following.


                            <f:metadata>
                                 <f:viewParam name="id" value="#{messageAction.messageId}" />
                                 <!-- s:viewAction action="#{messageAction.load}" /-->
                                 <f:event listener="#{messageAction.load}" type="preRenderView"></f:event>
                            </f:metadata>
                  



                  And changed the load method to:


                       @Transactional
                       public void load(ComponentSystemEvent event) {
                            if (log.isDebugEnabled()) {
                                 log.debug("call load...");
                            }
                  
                            this.currentMessage = em.find(Message.class, this.messageId);
                            this.currentMessage.addReadStatus(currentUser, new MessageReadStatus(
                                      this.currentMessage, currentUser, new Date()));
                            this.currentMessage = em.merge(this.currentMessage);
                       }
                  



                  It worked as expected.


                  • 6. Re: Applied Transactional on a view action will cause excption...
                    lightguard

                    Hantsy, could you please create a minimal war file (or better yet an arquillian test) to recreate this issue and attach it to the JIRA you created? Having a test or something ready to go really helps us in investigating a problem.

                    • 7. Re: Applied Transactional on a view action will cause excption...
                      hantsy

                      I found using the preRenderView did not persist the data correctly, it lost the relation between Message and MessageReadStatus.


                      When I added em.flush to the end of the load method, and got an exception.


                      java.lang.reflect.UndeclaredThrowableException
                           at $Proxy507.flush(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:597)
                           at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:48)
                           at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:125)
                           at org.jboss.weld.proxies.EntityManager$ManagedPersistenceContext$-886017761$Proxy$_$$_WeldClientProxy.flush(EntityManager$ManagedPersistenceContext$-886017761$Proxy$_$$_WeldClientProxy.java)
                           at com.telopsys.siorc.messaging.MessageAction.load(MessageAction.java:63)
                           at com.telopsys.siorc.messaging.994498211$Proxy$_$$_WeldSubclass.load(994498211$Proxy$_$$_WeldSubclass.java)
                           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:597)
                           at org.jboss.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:112)
                           at org.jboss.interceptor.proxy.InterceptorInvocationContext.proceed(InterceptorInvocationContext.java:119)
                           at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:152)
                           at org.jboss.seam.transaction.Work.workInTransaction(Work.java:49)
                           at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:148)
                           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:597)
                           at org.jboss.interceptor.proxy.InterceptorInvocation$InterceptorMethodInvocation.invoke(InterceptorInvocation.java:72)
                           at org.jboss.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:82)
                           at org.jboss.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:133)
                           at org.jboss.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:112)
                           at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:65)
                           at com.telopsys.siorc.messaging.994498211$Proxy$_$$_WeldSubclass.load(994498211$Proxy$_$$_WeldSubclass.java)
                           at com.telopsys.siorc.messaging.MessageAction$Proxy$_$$_WeldClientProxy.load(MessageAction$Proxy$_$$_WeldClientProxy.java)
                           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:597)
                           at org.apache.el.parser.AstValue.invoke(AstValue.java:196)
                           at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                           at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:43)
                           at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:56)
                           at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:98)
                           at com.sun.faces.facelets.tag.jsf.core.DeclarativeSystemEventListener.processEvent(EventHandler.java:121)
                           at javax.faces.component.UIComponent$ComponentSystemEventListenerAdapter.processEvent(UIComponent.java:2477)
                           at javax.faces.event.SystemEvent.processListener(SystemEvent.java:106)
                           at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:1993)
                           at com.sun.faces.application.ApplicationImpl.invokeComponentListenersFor(ApplicationImpl.java:1941)
                           at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:285)
                           at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:243)
                           at org.jboss.as.weld.webtier.jsf.ForwardingApplication.publishEvent(ForwardingApplication.java:293)
                           at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:670)
                           at org.jboss.seam.faces.environment.SeamApplicationWrapper$Proxy$_$$_WeldClientProxy.publishEvent(SeamApplicationWrapper$Proxy$_$$_WeldClientProxy.java)
                           at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:114)
                           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
                           at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
                           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
                           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
                           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                           at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67)
                           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                           at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
                           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                           at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)
                           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                           at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118)
                           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
                           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
                           at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139)
                           at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)
                           at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49)
                           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154)
                           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
                           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
                           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
                           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952)
                           at java.lang.Thread.run(Thread.java:662)
                      Caused by: java.lang.reflect.InvocationTargetException
                           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:597)
                           at org.jboss.seam.persistence.PersistenceContextProxyHandler.invoke(PersistenceContextProxyHandler.java:56)
                           at org.jboss.seam.persistence.ManagedPersistenceContextProxyHandler.invoke(ManagedPersistenceContextProxyHandler.java:108)
                           ... 80 more
                      Caused by: javax.validation.ConstraintViolationException: Validation failed for classes [com.telopsys.siorc.model.Message] during update time for groups [javax.validation.groups.Default, ]
                      List of constraint violations:[
                           ConstraintViolationImpl{interpolatedMessage='不能为空', propertyPath=messageId, rootBeanClass=class com.telopsys.siorc.model.Message, messageTemplate='{org.hibernate.validator.constraints.NotEmpty.message}'}
                      ]
                           at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.validate(BeanValidationEventListener.java:158)
                           at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.onPreUpdate(BeanValidationEventListener.java:101)
                           at org.hibernate.action.internal.EntityUpdateAction.preUpdate(EntityUpdateAction.java:200)
                           at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:88)
                           at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:273)
                           at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:265)
                           at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:187)
                           at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:336)
                           at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
                           at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1073)
                           at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:965)
                           ... 86 more
                      


                      • 8. Re: Applied Transactional on a view action will cause excption...
                        hantsy

                        In the Message class, I used a Map for the one to many relation


                        @OneToMany(cascade = CascadeType.ALL, mappedBy = "message")
                             @MapKey(name = "user")
                        /*     @OrderColumn(name = "status_index")*/
                             private Map<UserAccount, MessageReadStatus> readStatus = new HashMap<UserAccount, MessageReadStatus>();
                        



                        The above code fragments were migrated from my original Seam2 application.

                        • 9. Re: Applied Transactional on a view action will cause excption...
                          hantsy

                          Jason Porter wrote on Oct 27, 2011 00:26:


                          Hantsy, could you please create a minimal war file (or better yet an arquillian test) to recreate this issue and attach it to the JIRA you created? Having a test or something ready to go really helps us in investigating a problem.


                          OK, I will create a standalone application and reproduce the problems...

                          • 10. Re: Applied Transactional on a view action will cause excption...
                            lightguard

                            At the bottom of the stack trace it looks like it's caused by a constraint violation:


                            Caused by: javax.validation.ConstraintViolationException: Validation failed for classes [com.telopsys.siorc.model.Message] during update time for groups [javax.validation.groups.Default, ]
                            List of constraint violations:[
                                    ConstraintViolationImpl{interpolatedMessage='不能为空', propertyPath=messageId, rootBeanClass=class com.telopsys.siorc.model.Message, messageTemplate='{org.hibernate.validator.constraints.NotEmpty.message}'}
                            ]

                            • 11. Re: Applied Transactional on a view action will cause excption...
                              hantsy

                              Oh...the messageId was added by others...I remove the constraint and try again now.

                              • 12. Re: Applied Transactional on a view action will cause excption...
                                hantsy

                                Ha...it is caused by the validation constraint...I am sorry for my mistake.

                                • 13. Re: Applied Transactional on a view action will cause excption...
                                  lightguard

                                  :) no problem. I think we've all been bit at least once by not looking at the actual root cause of an exception and only looking at the top (something Catch, now Solder, fixes btw, if you use the feature).

                                  • 14. Re: Applied Transactional on a view action will cause excption...
                                    ratking

                                    @hantsy bai


                                    Was such ah


                                    你好。
                                    原来是由于指定了“不能为空”的约束条件,导致Bean validator抛出异常,进而不能提交事务。
                                    我还以为可能是与注入的EntiyManager类型有关呢?原来竟不是,幸甚。
                                    我试用普通EntiyManager与Seam管理的EntityManager(SMPC),感觉有许多不同。可我总结不出什么使用该用哪个,看了些英文文章和例子也没弄懂。
                                    尤其是这个em与EJB或事务一起使用时,或与JPA的懒加载一起使用时,我在GlassFish里尝试对其进行各种组合,都有这样那样的异常,没找到合理使用的规律 :-(


                                    我英文不行,English的论坛能看懂,但要是英文交流就很怵。虽然从Seam 3刚出现就开始跟进,但进步不大,试用 Seam 3.1.0.beta + EJB 3.1 + PrimeFaces 3.0.M4 + GlassFish 3.1.2.bete ,遇到不少事务异常、懒加载异常,几经尝试也不知该如何处理。在国内找不到能讨论的地方,ITEYE的Seam圈子也没什么实质内容。


                                    看到你在Seam官网发言,又顺便找到了你在ITEYE的文章,对你很崇拜。


                                    翻墙读了 http://debasishg.blogspot.com/2006/06/stateful-thinking-with-jboss-seam.html 以及 http://blog.frankel.ch/why-cdi-wont-replace-spring 尽管是旧文章,里面批评Seam的话我觉得好像也在理呀~


                                    国内使用过Seam的人不多,我只知道两个,一个是hantsy bai,另一个是wu haixing。


                                    关于Seam 3的事务异常、懒加载异常等相关问题该如何解决?诸如此类挫折困扰着我,非常想向您请教与探讨。


                                    ratking (at) ynet.com
                                    2011-11-19

                                    1 2 Previous Next