1 Reply Latest reply on Sep 18, 2009 10:59 PM by Seamus Singh

    Jbpm process cannot resolve expression

    Seamus Singh Newbie

      I have a jbpm process that is initiated when a user register's to use the system. The purpose of the process is to wait a set period of time and then delete the user from the system if the user has not validated the account.


      My process definition is:


      <?xml version="1.0" encoding="UTF-8"?>
      
      <process-definition  xmlns=""  name="UserRegistration">
           <start-state name="start">
                <transition to="userPending"></transition>
           </start-state>
      
           <state name="userPending">
                <timer duedate="1 minutes" name="waitForExpiry" transition="expired">
                     <action></action>
                </timer>
                <transition to="deletePendingUser" name="expired"></transition>
           </state>
      
           <node name="deletePendingUser">
                <action expression="#{registrationExpiry.deleteExpiredUser}"></action>
                <transition to="end" name="finished"></transition>
           </node>
      
           <end-state name="end"></end-state>
      </process-definition>



      This is the seam component that I am trying to use.


      @Name("registrationExpiry")
      @Stateless
      public class RegistrationExpiryAction implements RegistrationExpiry {
           @In(value="registeredUserId", scope=ScopeType.BUSINESS_PROCESS, required=false)
           @Out(value="registeredUserId", scope=ScopeType.BUSINESS_PROCESS, required=false)
           private Integer registeredUserId;
      
           @PersistenceContext
           EntityManager em;
      
           public void deleteExpiredUser() {
                em.createNamedQuery(User.DELETE_EXPIRED_USER)
                .setParameter("userId", registeredUserId)
                .executeUpdate();
           }
      }



      When the user successfully registers the process is being started and an instance is being created successfully.  When the timer expires the process transitions to the deletePendingUser node and then then the following error is logged:


      21:14:08,169 ERROR [GraphElement] action threw exception: couldn't evaluate expression '#{registrationExpiry.deleteExpiredUser}'
      org.jbpm.JbpmException: couldn't evaluate expression '#{registrationExpiry.deleteExpiredUser}'
           at org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator.evaluate(JbpmExpressionEvaluator.java:43)
           at org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator.evaluate(JbpmExpressionEvaluator.java:30)
           at org.jbpm.graph.def.Action.execute(Action.java:125)
           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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
           at org.jbpm.graph.def.Action_$$_javassist_60.execute(Action_$$_javassist_60.java)
           at org.jboss.seam.bpm.SeamUserCodeInterceptor$1.process(SeamUserCodeInterceptor.java:80)
           at org.jboss.seam.bpm.SeamUserCodeInterceptor$ContextualCall.run(SeamUserCodeInterceptor.java:40)
           at org.jboss.seam.bpm.SeamUserCodeInterceptor.executeAction(SeamUserCodeInterceptor.java:74)
           at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:282)
           at org.jbpm.graph.def.Node.execute(Node.java:414)
           at org.jbpm.graph.def.Node.enter(Node.java:390)
           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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
           at org.jbpm.graph.def.Node_$$_javassist_106.enter(Node_$$_javassist_106.java)
           at org.jbpm.graph.def.Transition.take(Transition.java:167)
           at org.jbpm.graph.def.Node.leave(Node.java:479)
           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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
           at org.jbpm.graph.node.State_$$_javassist_100.leave(State_$$_javassist_100.java)
           at org.jbpm.graph.exe.Token.signal(Token.java:223)
           at org.jbpm.graph.exe.Token.signal(Token.java:180)
           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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
           at org.jbpm.graph.exe.Token_$$_javassist_42.signal(Token_$$_javassist_42.java)
           at org.jbpm.job.Timer.execute(Timer.java:87)
           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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
           at org.jbpm.job.Job_$$_javassist_110.execute(Job_$$_javassist_110.java)
           at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:166)
           at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:60)
      Caused by: org.jbpm.jpdl.el.ELException: Error evaluating ${registrationExpiry.deleteExpiredUser}; possible causes are logged at debug level
           at org.jboss.seam.bpm.SeamExpressionEvaluator$1.evaluate(SeamExpressionEvaluator.java:142)
           at org.jboss.seam.bpm.SeamExpressionEvaluator.evaluate(SeamExpressionEvaluator.java:45)
           at org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator.evaluate(JbpmExpressionEvaluator.java:39)
           ... 45 more
      



      My jbpm.cfg is:


      <jbpm-configuration>
      
        <jbpm-context>
          <service name="persistence">
             <factory>
                <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
                   <field name="isTransactionEnabled"><false/></field>
                </bean>
             </factory>
          </service>
          <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
          <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
          <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
          <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
          <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
        </jbpm-context>
      
      </jbpm-configuration>



      The hibernate.cfg.xml for Jbpm is:


      <?xml version='1.0' encoding='utf-8'?>
      
      <!DOCTYPE hibernate-configuration PUBLIC
                "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
      
      <hibernate-configuration>
        <session-factory>
      
          <property name="show_sql">false</property>
          <property name="connection.datasource">java:/festivalDatasource</property>
          <property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
          <property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
          <property name="cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
          <property name="hbm2ddl.auto">create-drop</property>
          <!--property name="transaction.flush_before_completion">true</property-->
      
      ...
      ...    
      


      Datasource is:


      <?xml version="1.0" encoding="UTF-8"?>
      
      <!DOCTYPE datasources
          PUBLIC "-//JBoss//DTD JBOSS JCA Config 5.0//EN"
          "http://www.jboss.org/j2ee/dtd/jboss-ds_5_0.dtd">
      
      <datasources>
           <xa-datasource>
               <jndi-name>myDatasource</jndi-name>
               <xa-datasource-property name="URL">jdbc:mysql://localhost/my_schema?zeroDateTimeBehavior=convertToNull</xa-datasource-property>
               <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
               <user-name>my_user</user-name>
               <password>my_pwd</password>
               <track-connection-by-tx />
               <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
               <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
               <min-pool-size>1</min-pool-size>
               <max-pool-size>10</max-pool-size>
               <idle-timeout-minutes>10</idle-timeout-minutes>
               <metadata><type-mapping>mySQL</type-mapping></metadata>
           </xa-datasource>
       </datasources>






      My environment is as follows:




      • Seam 2.2.0.GA

      • JBoss AS 5.1.0.GA

      • Jbpm 3.3 (I have tried versions 3.2.5, 3.2.6 as well).



      I have tried a number of different things, such as using an action (this leads to the an error with external managed transaction that I have seen documented elsewhere). I originally also had a local datasource before I tried the xa-datasource.


      I would be grateful if anyone can offer some help in helping me how to achieve what I am trying to do. Am I doing this correct way, etc?

        • 1. Re: Jbpm process cannot resolve expression
          Seamus Singh Newbie

          Sorry, datasource should be:


          <?xml version="1.0" encoding="UTF-8"?>
          
          <!DOCTYPE datasources
              PUBLIC "-//JBoss//DTD JBOSS JCA Config 5.0//EN"
              "http://www.jboss.org/j2ee/dtd/jboss-ds_5_0.dtd">
          
          <datasources>
               <xa-datasource>
                   <jndi-name>festivalDatasource</jndi-name>
                   <xa-datasource-property name="URL">jdbc:mysql://localhost/my_schema?zeroDateTimeBehavior=convertToNull</xa-datasource-property>
                   <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                   <user-name>my_user</user-name>
                   <password>my_pwd</password>
                   <track-connection-by-tx />
                   <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
                   <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
                   <min-pool-size>1</min-pool-size>
                   <max-pool-size>10</max-pool-size>
                   <idle-timeout-minutes>10</idle-timeout-minutes>
                   <metadata><type-mapping>mySQL</type-mapping></metadata>
               </xa-datasource>
           </datasources>