1 Reply Latest reply on Jan 24, 2008 7:03 AM by Ronald van Kuijk

    Expression Language not worked in JBPM-jpdl-3.2.2

    Soumyajit Paul Newbie

      I used a back-end bean like this.

      public String strUser = "user";
       public String getStrUser() {
       return strUser;
       }
       public void setStrUser(String strUser) {
       this.strUser = strUser;
       }
      

      I used a Expression Language to this Processdefinition.xml as follows.
      <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="loanProcess">
       <start-state name="start-state1">
       <task name="StartTask"></task>
       <transition to="task-node1"></transition>
       </start-state>
       <event type="task-create">
       <action class="com.sample.action.AssignUsr"></action>
       </event>
       <task-node name="task-node1">
       <task name="task1"> <assignment expression="user(#{obj[strUser]})"></assignment>
       </task>
       <transition to="End"></transition>
       </task-node>
       <end-state name="End"></end-state>
      

      I set the back-end bean object to contextInstance in the following way in the JUnit
      processInstance.getContextInstance().setVariable("obj", obj);
      

      Got a stack trace like this
      14:28:27,401 [main] DEBUG ExpressionAssignmentHandler : resolving first term 'user(#{obj[strUser]})'
      Exception in thread "main" org.jbpm.graph.def.DelegationException: couldn't resolve assignment expression 'user(#{obj[strUser]})'
       at org.jbpm.taskmgmt.exe.TaskMgmtInstance.performAssignment(TaskMgmtInstance.java:216)
       at org.jbpm.taskmgmt.exe.TaskInstance.assign(TaskInstance.java:204)
       at org.jbpm.taskmgmt.exe.TaskMgmtInstance.createTaskInstance(TaskMgmtInstance.java:154)
       at org.jbpm.graph.node.TaskNode.execute(TaskNode.java:168)
       at org.jbpm.graph.def.Node.enter(Node.java:319)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
       at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$89d40aac.enter(<generated>)
       at org.jbpm.graph.def.Transition.take(Transition.java:151)
       at org.jbpm.graph.def.Node.leave(Node.java:394)
       at org.jbpm.graph.node.StartState.leave(StartState.java:70)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
       at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$89d40aac.leave(<generated>)
       at org.jbpm.graph.exe.Token.signal(Token.java:195)
       at org.jbpm.graph.exe.Token.signal(Token.java:140)
       at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:271)
       at com.cts.client.TestClient.main(TestClient.java:30)
      Caused by: org.jbpm.identity.assignment.ExpressionAssignmentException: couldn't resolve assignment expression 'user(#{obj[strUser]})'
       at org.jbpm.identity.assignment.ExpressionAssignmentHandler.assign(ExpressionAssignmentHandler.java:97)
       at org.jbpm.taskmgmt.exe.TaskMgmtInstance.performAssignmentDelegation(TaskMgmtInstance.java:228)
       at org.jbpm.taskmgmt.exe.TaskMgmtInstance.performAssignment(TaskMgmtInstance.java:201)
       ... 23 more
      Caused by: org.jbpm.identity.assignment.ExpressionAssignmentException: user '#{obj[strUser]}' couldn't be fetched from the user db
       at org.jbpm.identity.assignment.ExpressionAssignmentHandler.getUserByName(ExpressionAssignmentHandler.java:209)
       at org.jbpm.identity.assignment.ExpressionAssignmentHandler.resolveFirstTerm(ExpressionAssignmentHandler.java:147)
       at org.jbpm.identity.assignment.ExpressionAssignmentHandler.assign(ExpressionAssignmentHandler.java:75)
       ... 25 more
      

      Am i doing something wrong!!!!
      Is there any way to do the following i.e. to access certain variable from a back-end bean using Expression...

      NB:- My jpbm is not integrated with Seam and I used to assign the task to that user whichever I wish to set in my back-end bean
      Thanks
      Soumya