0 Replies Latest reply on Mar 17, 2010 10:30 PM by David D

    EntityHome.update() fails in a JBPM task

    David D Newbie

      Hi,


      (Seam 2.2.0, JBoss 4.2.3, jdk6)


      I'm trying to set up a JBPM process (inspired from Seam in Action, chapter 14) :



      1. some user changes the email of his account

      2. an email is sent to the new specified address

      3. the user opens a generated URL to confirm

      4. the account is actually updated



      @Name("changeUserEmail")
      @Scope(ScopeType.EVENT)
      public class ChangeUserEmailAction
      {
          /** The request parameter of the confirmation code. */
          @RequestParameter("code")
          protected String confirmationCodeParam;
      
          /** Manages the UserAccount. */
          @In(create = true)
          private UserAccountHome userAccountHome;
      
          @BeginTask
          @EndTask(transition = "confirmed")
          public String confirm()
          {
              final UserAccount cueUserAccount = // from BPM context
              final String cueNewEmail = // from BPM context
              final String cueConfirmationCode = // from BPM context
      
              if (StringUtils.equals(confirmationCodeParam, cueConfirmationCode))
              {
                  userAccountHome.setId(cueUserAccount.getId());
                  userAccountHome.getInstance().getUser().setEmail(cueNewEmail);
      
                  // *************************** 
                  userAccountHome.update();
                  // *************************** 
      
                  confirmed = true;
                  return "confirmed";
              }
      
              confirmed = false;
              return null;
          }
      }
      




      If I remove userAccountHome.update(), I don't have:



      Exception during request processing: 
      Caused by java.lang.NullPointerException with message: "Argument Error: Parameter message is null" 
      com.sun.faces.util.Util.notNull(Util.java:241)
      com.sun.faces.context.FacesContextImpl.addMessage(FacesContextImpl.java:322)
      org.jboss.seam.faces.FacesMessages.beforeRenderResponse(FacesMessages.java:46)
      org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:484)
      org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:148)
      org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:118)
      com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)
      com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
      org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
      org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
      org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      name.didier.david.seam.filter.SessionIdFilter.doFilter(SessionIdFilter.java:131)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
      org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      java.lang.Thread.run(Thread.java:619)



      As far as I understand (which is not very far):
      What I can see while debugging is that userAccountHome.update() is raising an event (raiseAfterTransactionSuccessEvent()) which ends the task, so BusinessProcess.resumeTask() is called a second times with the ID of the already ended task. Then BusinessProcess.taskEnded() is called and for some reason the message cannot be interpolated.


      Maybe I'm doing things completely wrong, but I really cannot understand what's going on. Any help will be greatly appreciated...


      David