cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid content was found starting with element 'serviceTask

susubhas
Champ in-the-making
Champ in-the-making
Hi,

I have a sample process, while executing i am getting invalid content error, i am not able to figure out what is wrong.

Process

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
        targetNamespace="http://www.bpmnwithactiviti.org"
        xmlns:activiti="http://activiti.org/bpmn">
    <process id="transactionalProcess" name="Simple Process">

        <startEvent id="startevent1" name="Start"/>

        <sequenceFlow id="sequenceflow1"
                sourceRef="startevent1" targetRef="bookHotel"/>

        <serviceTask id="bookHotel" name="Book Hotel"
                activiti:class="com.test.activiti.transactional.BookHotelJavaDelegate">
            <documentation>Book Hotel</documentation>
        </serviceTask>

        <boundaryEvent id="compensateBookHotelTask" attachedToRef="bookHotel">
            <compensateEventDefinition />
        </boundaryEvent>

        <association associationDirection="One" id="a1" sourceRef="compensateBookHotelTask" targetRef="undoBookHotel"/>

        <serviceTask id="undoBookHotel" isForCompensation="true" activiti:class="com.test.activiti.transactional.CancelHotelBookingJavaDelegate" />
        <!–<serviceTask isForCompensation="true" id="undoBookHotel"  activiti:class=""/>–>

        <sequenceFlow id="sequenceflow2"
                sourceRef="bookHotel" targetRef="endevent1"/>

        <sequenceFlow id="sequenceflow3"
                sourceRef="bookHotel" targetRef="compensate"/>

        <endEvent id="compensate">
            <compensateEventDefinition />
        </endEvent>



        <endEvent id="endevent1" name="End"/>

    </process>
</definitions>



Error stack trace -

org.activiti.engine.ActivitiException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'serviceTask'. One of '{"http://www.omg.org/spec/BPMN/20100524/MODEL':artifact, "http://www.omg.org/spec/BPMN/20100524/MODEL':resourceRole, "http://www.omg.org/spec/BPMN/20100524/MODEL':correlationSubscription, "http://www.omg.org/spec/BPMN/20100524/MODEL':supports}' is expected. | compensation.bpmn20.xml | line 23 | column 149

   at org.activiti.engine.impl.util.xml.Parse.throwActivitiExceptionForErrors(Parse.java:186)
   at org.activiti.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java:237)
   at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeployer.java:90)
   at org.activiti.engine.impl.persistence.deploy.DeploymentCache.deploy(DeploymentCache.java:38)
   at org.activiti.engine.impl.persistence.entity.DeploymentManager.insertDeployment(DeploymentManager.java:42)
   at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:59)
   at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:31)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:54)
   at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:106)
   at com.cisco.activiti.transactional.Test.main(Test.java:27)
   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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Exception in thread "main" org.activiti.engine.ActivitiException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'serviceTask'. One of '{"http://www.omg.org/spec/BPMN/20100524/MODEL':artifact, "http://www.omg.org/spec/BPMN/20100524/MODEL':resourceRole, "http://www.omg.org/spec/BPMN/20100524/MODEL':correlationSubscription, "http://www.omg.org/spec/BPMN/20100524/MODEL':supports}' is expected. | compensation.bpmn20.xml | line 23 | column 149

   at org.activiti.engine.impl.util.xml.Parse.throwActivitiExceptionForErrors(Parse.java:186)
   at org.activiti.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java:237)
   at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeployer.java:90)
   at org.activiti.engine.impl.persistence.deploy.DeploymentCache.deploy(DeploymentCache.java:38)
   at org.activiti.engine.impl.persistence.entity.DeploymentManager.insertDeployment(DeploymentManager.java:42)
   at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:59)
   at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:31)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:54)
   at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:106)
   at com.test.activiti.transactional.Test.main(Test.java:27)
   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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Process finished with exit code 1
1 REPLY 1

susubhas
Champ in-the-making
Champ in-the-making
Resolved it Smiley Happy

<association> element should be the last element.