Rovo (12) [Avatar] Offline
#1
Hi,

I tried to deploy and run the book order example from the svn on camunda fox and after submitting a new order I get a PropertyNotFoundException: Cannot resolve identifier 'bookOrderTask' - the code is unchanged and I used "mvn clean package" (mvn clean install produces the same war-file) to build the war-file

Moreover, in the book on page 227 it is explained that on extending from JndiProcessEngineLookup we can make use of camunda fox's process engine - but the activit-cdi module does not provide this class in my case (version 5.9) and the full class name is not provided in the book too.

As http://svn.codehaus.org/activiti/activiti/branches/ACT-989/modules/activiti-cdi/src/main/java/org/activiti/cdi/impl/JndiProcessEngineLookup.java includes an experimental comment I guess this feature will be available in the next version?

So, what am I missing here? In my opinion this Exception is raised on invoking the validateTask service task (<serviceTask id="validateTask" activiti:expression="#{bookOrderTask.validate()}" />smilie as this is the first time the bookOrderTask is invoked. The other CDI classes seem to work as currentUser.username is set inside taskList.jsf automatically.

Kind regards,
Roman
tijs.rademakers (494) [Avatar] Offline
#2
Re: C9.2.2 PropertyNotFoundException: Cannot resolve identifier 'bookOrderTask'
Hi,

I just ran the example on a JBoss 7.1 server and that works fine. Which version of Camunda fox are you using?
You're right that the JndiProcessEngineLookup class is not present anymore in the Activiti CDI module, it was before. You can see it here:

https://fisheye.codehaus.org/browse/activiti/activiti/trunk/modules/activiti-cdi/src/main/java/org/activiti/cdi/impl

I can see if I can add that JNDI lookup class again to trunk.

Best regards,

Tijs
Rovo (12) [Avatar] Offline
#3
Re: C9.2.2 PropertyNotFoundException: Cannot resolve identifier 'bookOrderTask'
Hi Tijs,

I do run camunda fox ce version: 1.22.0 jboss as server version: 7.1.0.Final

Eclipse is showing me version number 319 for the project and the pom. I build the war-file using 'mvn clean package' and deploy the war-file into %CAMUNDA_FOX%/jboss-as-7.1.0.Finalstandalonedeployments directory where the deployment does not produce any errors. On runing maven I'll get some warnings due to missing version settings or missing encoding definitions (Platform encoding is Cp1252) and a web.xml file which is ignored as a web.xml file is already present

Maven improvements:
<properties>
...
<!-- Remove platform dependency warning -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
...
</properties>
<build>
...
<!-- Avoid warnings of ignoring web.xml file as it already exists -->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
</configuration>
</plugin>
...
</build>

I see the bookorder task and the link to start the process. After clicking on the link I get forwarded to the page where I have to enter an ISBN-number (6 numbers). On clicking the submit-button I'll end up with

javax.servlet.ServletException: org.activiti.engine.ActivitiException: Unknown property used in expression
javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
...

root cause

org.activiti.engine.ActivitiException: Unknown property used in expression
org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:55)
org.activiti.engine.impl.bpmn.behavior.ServiceTaskExpressionActivityBehavior.execute(ServiceTaskExpressionActivityBehavior.java:39)
org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:44)
org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:79)
com.camunda.fox.platform.impl.configuration.CmpeCommandContext.performOperation(CmpeCommandContext.java:55)
...
root cause

org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'bookOrderTask'
org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83)
org.activiti.engine.impl.juel.AstMethod.invoke(AstMethod.java:79)
org.activiti.engine.impl.juel.AstMethod.eval(AstMethod.java:75)
org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:50)
org.activiti.engine.impl.juel.AstNode.getValue(AstNode.java:26)
org.activiti.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)
org.activiti.engine.impl.delegate.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33)
org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
com.camunda.fox.platform.impl.configuration.CmpeVariableFlushingDelegateInterceptor.handleInvocation(CmpeVariableFlushingDelegateInterceptor.java:57)
...

At the moment I try to integrate Activiti in a JSF based web application - without any application server, so no CDI available (so only using Tomcat) - the book-cdi-app is only to see how things work together. I therefore have created a singleton class which holds the reference to the Activiti Engine which gets referenced as a managed bean in the faces-config.xml. This is working as intended (I can start the process and get the process id in return) but I'm a bit unsure on how to set the navigation to show the page for the current task as defined in the process description, f.e. I have defined:

<!-- inside a sub-process -->
<startEvent id="startevent2" name="Start" />
<userTask id="getAddress" name="get address" activiti:assignee="kermit" activiti:formKey="addressForm.jsf">
<!-- <br /> <extensionElements> <br /> <activiti:formProperty id="firstName" name="First Name" type="string" required="true"></activiti:formProperty> <br /> <activiti:formProperty id="lastName" name="Last name" type="string" required="true"></activiti:formProperty> <br /> <activiti:formProperty id="street" name="Street" type="string" required="true"></activiti:formProperty> <br /> <activiti:formProperty id="zip" name="Zip-Code" type="string" required="true"></activiti:formProperty> <br /> <activiti:formProperty id="city" name="City" type="string" required="true"></activiti:formProperty> <br /> <activiti:formProperty id="country" name="Country" type="string" required="true"></activiti:formProperty> <br /> <activiti:formProperty id="telNo" name="Telephone" type="string" required="false"></activiti:formProperty> <br /> </extensionElements> <br /> -->

So after starting the process via:
Map<String, Object> variableMap = new HashMap<String, Object>();
variableMap.put(some_var, someValue);
RuntimeService runtimeService = ActivitiEngine.getInstance(processDescription).getProcessEngine().getRuntimeService();
ProcessInstance instance = runtimeService.startProcessInstanceByKey(processName, variableMap);

how do I retrieve the addressForm.jsf and set the navigation in jsf to show this page?

A solution that would come to my mind is to call the FormService inside the backing bean and just insert the values taken from the jsf page (uncommenting the extensionElements therefore) and use simple navigation definitions inside the faces-config.xml and do the navigations myself. I will use this approach only if I'm unable to show the page defined in the process description as this will introduce further required handling in case the execution is non-linear (xor or loops) which does make the Activiti definition somehow redundant as the actual navigation has to be defined in jsf too.

Thank you for your input so far,
Roman

---

EDIT: found a way to retrieve the formKey in the process definition via: processEngine.getFormService().getTaskFormData(task.getId()).getFormKey()