cancel
Showing results for 
Search instead for 
Did you mean: 

Start Process by Disabling Validation

zohaibjabbar
Champ in-the-making
Champ in-the-making
Hi,

I am parsing a bpmn file using Activiti and all goes well. However, if I do not define any 'script' in Script Task then bpmn file will not get deployed. I was going through the functions and came across "disableValidation" function. Now when I call this function and deploy the process, then process will not start.


DeploymentBuilder d = repositoryService.createDeployment();
         d.addClasspathResource("bpmnFiles/"+fileName);
         d.disableBpmnValidation();
         Deployment dep = d.deploy();

         runtimeService = processEngine.getRuntimeService();
         processInstance = runtimeService.startProcessInstanceByKey("myProcess");


A Null Pointer exception is thrown at the last line of code.


java.lang.NullPointerException
   at org.activiti.engine.impl.juel.Scanner.next(Scanner.java:452)
   at org.activiti.engine.impl.juel.Parser.consumeToken(Parser.java:252)
   at org.activiti.engine.impl.juel.Parser.tree(Parser.java:277)
   at org.activiti.engine.impl.juel.Builder.build(Builder.java:95)
   at org.activiti.engine.impl.juel.TreeStore.get(TreeStore.java:61)
   at org.activiti.engine.impl.juel.TreeValueExpression.<init>(TreeValueExpression.java:62)
   at org.activiti.engine.impl.juel.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:428)
   at org.activiti.engine.impl.juel.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:73)
   at org.activiti.engine.impl.scripting.JuelScriptEngine.parse(JuelScriptEngine.java:142)
   at org.activiti.engine.impl.scripting.JuelScriptEngine.eval(JuelScriptEngine.java:86)
   at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)


Can I deploy and start the process if no script is available in script task?
My only purpose is to get BpmnModel Object for this xml file.
7 REPLIES 7

zohaibjabbar
Champ in-the-making
Champ in-the-making
I was getting BpmnModel object using:
<code> BpmnModel model=repositoryService.getBpmnModel(String.valueOf(processInstance.getProcessDefinitionId())); </code>

But Process Instance object is not being initialized if Script Task Element does not contain any script.

Thanks for any help/pointer/suggestion.

jbarrez
Star Contributor
Star Contributor
I'm not really following .. having a script task element doesn't have any influence on this all.
Please post the process definition XML that is causing this.

zohaibjabbar
Champ in-the-making
Champ in-the-making
Sorry for not being clear in the first place.

I have attached my bpmn xml file.

The same file get deployed perfectly fine if I just convert the script task to manual task. And after deployment I am able to get process instance from runtime service and then I retrieve bpmn model.

However, with script task, I get the error that no script found. I have also attached the log file. Thanks for the help.

My Process Definition (complete file also attached):
<code>
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="myProcess" name="myProcess" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="scripttask2"></sequenceFlow>
    <parallelGateway id="parallelgateway1" name="Parallel Gateway"></parallelGateway>
    <sequenceFlow id="flow2" sourceRef="scripttask2" targetRef="parallelgateway1"></sequenceFlow>
    <userTask id="usertask1" name="User Task"></userTask>
    <sequenceFlow id="flow3" sourceRef="parallelgateway1" targetRef="usertask1"></sequenceFlow>
    <callActivity id="callactivity1" name="Call activity"></callActivity>
    <sequenceFlow id="flow4" sourceRef="usertask1" targetRef="callactivity1"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow5" sourceRef="callactivity1" targetRef="endevent1"></sequenceFlow>
    <sequenceFlow id="flow7" sourceRef="parallelgateway1" targetRef="scripttask1"></sequenceFlow>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow8" sourceRef="scripttask1" targetRef="exclusivegateway1"></sequenceFlow>
    <sequenceFlow id="flow9" sourceRef="exclusivegateway1" targetRef="usertask1"></sequenceFlow>
    <userTask id="usertask2" name="User Task"></userTask>
    <sequenceFlow id="flow10" sourceRef="exclusivegateway1" targetRef="usertask2"></sequenceFlow>
    <endEvent id="endevent2" name="End"></endEvent>
    <sequenceFlow id="flow11" sourceRef="usertask2" targetRef="endevent2"></sequenceFlow>
    <scriptTask id="scripttask1" name="Script Task" activiti:autoStoreVariables="false"></scriptTask>
    <scriptTask id="scripttask2" name="Service Task" activiti:autoStoreVariables="false"></scriptTask>
  </process>
</code>

error:
<code>
2016-03-01 22:12:23 ERROR ActivitiDeployment.<init>:61 - Errors while parsing:
[Validation set: 'activiti-executable-process' | Problem: 'activiti-scripttask-missing-script'] : No script provided for script task - [Extra info : processDefinitionId = myProcess | processDefinitionName = myProcess |  | id = scripttask1 |  | activityName = Script Task | ] ( line: 22, column: 89)
[Validation set: 'activiti-executable-process' | Problem: 'activiti-scripttask-missing-script'] : No script provided for script task - [Extra info : processDefinitionId = myProcess | processDefinitionName = myProcess |  | id = scripttask2 |  | activityName = Service Task | ] ( line: 23, column: 90)

org.activiti.engine.ActivitiException: Errors while parsing:
[Validation set: 'activiti-executable-process' | Problem: 'activiti-scripttask-missing-script'] : No script provided for script task - [Extra info : processDefinitionId = myProcess | processDefinitionName = myProcess |  | id = scripttask1 |  | activityName = Script Task | ] ( line: 22, column: 89)
[Validation set: 'activiti-executable-process' | Problem: 'activiti-scripttask-missing-script'] : No script provided for script task - [Extra info : processDefinitionId = myProcess | processDefinitionName = myProcess |  | id = scripttask2 |  | activityName = Service Task | ] ( line: 23, column: 90)
</code>

In my case I just need to be able to populate bpmn model object using Activiti Parser. The scripts might and might not be present in the Script Task at the time when I need to parse bpmn file.
I also tried disable validation function at the time of deployment but even that did not work for me.

Thanks for the help.

zohaibjabbar
Champ in-the-making
Champ in-the-making
I really appreciate any pointer in the right direction.
Please let me know if I can provide any further information.

jbarrez
Star Contributor
Star Contributor
So the exception is clear, you have no script element for the script task, which is invalid.

Disabling the validation should work … how did you try to disable it?

zohaibjabbar
Champ in-the-making
Champ in-the-making
Yes, the exception is very clear and thus I disabled the validation while deploying the process (code below). But even after disabling the validation the process won't start executing. For example, even when I have disabled the validation, I cannot get bpmn model object from process instance as process could not be deployed.
<code>
DeploymentBuilder d = repositoryService.createDeployment();
   d.addClasspathResource("bpmnFiles/"+fileName);
   d.disableBpmnValidation();
   Deployment dep = d.deploy();

   runtimeService = processEngine.getRuntimeService();
   processInstance = runtimeService.startProcessInstanceByKey("myProcess");
</code>

Thanks,

jbarrez
Star Contributor
Star Contributor
Okay - and how does your BPMNParseHandler look like where you attach the script?