2

嗨,我在我的应用程序中使用 Activiti 框架来管理工作流程。我为演示目的创建了一个非常基本的流程定义,它工作得很好。但是当我在流程定义中包含条件表达式以获取上述异常时,我得到了上述错误。以下是流程定义

 <definitions id="definitions"
         targetNamespace="http://activiti.org/bpmn20" 
         xmlns:activiti="http://activiti.org/bpmn"
         xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">

 <process id="pms" name="Monthly financial report reminder process">

    <startEvent id="theStart" />

    <sequenceFlow id='flow1' sourceRef='theStart' targetRef='engORpro' />

    <userTask id="initialization" name="prepare PO and shedule date" >
        <documentation>
            PO details and shedule milestones
        </documentation>
        <potentialOwner>
            <resourceAssignmentExpression>
                <formalExpression>initialization</formalExpression>
            </resourceAssignmentExpression>
        </potentialOwner>
    </userTask>
    <sequenceFlow id='engORpro' sourceRef='engORpro' targetRef='exclusiveGw' />
    <exclusiveGateway id="exclusiveGw" name="Exclusive Gateway" />

    <sequenceFlow id='flow2' sourceRef='exclusiveGw' targetRef='engineering' >
        <conditionExpression xsi:type="tFormalExpression">${engineering==false}</conditionExpression>
    </sequenceFlow>
     <sequenceFlow id='flow11' sourceRef='exclusiveGw' targetRef='procurement' >
        <conditionExpression xsi:type="tFormalExpression">${engingeering==true}</conditionExpression>
    </sequenceFlow>

    <userTask id="engineering" name="prepare BOQ Rule of Credit and plan dates" >
        <documentation>
            prepare BOQ Rule of Credit and plan dates
        </documentation>
        <potentialOwner>
            <resourceAssignmentExpression>
                <formalExpression>engineering</formalExpression>
            </resourceAssignmentExpression>
        </potentialOwner>
    </userTask>

    <sequenceFlow id='flow3' sourceRef='engineering' targetRef='procurement' />

    <userTask id="procurement" name="obtain raw material" >
        <documentation>
            prepare current meterial status and calculate Rule of Credit
        </documentation>
        <potentialOwner>
            <resourceAssignmentExpression>
                <formalExpression>procurement</formalExpression>
            </resourceAssignmentExpression>
        </potentialOwner>
    </userTask>
    <sequenceFlow id='flow4' sourceRef='procurement' targetRef='construction' />

    <userTask id="construction" name="construction of machine" >
        <documentation>
            plan man hour and set actual delivery dates   
        </documentation>
        <potentialOwner>
            <resourceAssignmentExpression>
                <formalExpression>construction</formalExpression>
            </resourceAssignmentExpression>
        </potentialOwner>
    </userTask>

    <sequenceFlow id='flow5' sourceRef='construction' targetRef='finalHandover' />
    <userTask id="finalHandover" name="Final Handover" >
        <documentation>
            prepare current meterial status and calculate Rule of Credit
        </documentation>
        <potentialOwner>
            <resourceAssignmentExpression>
                <formalExpression>management</formalExpression>
            </resourceAssignmentExpression>
        </potentialOwner>
    </userTask>
    <sequenceFlow id='flow6' sourceRef='finalHandover' targetRef='theEnd' />
    <endEvent id="theEnd" />

</process>

当我运行它时,我得到以下异常

   Exception in thread "main" java.lang.ExceptionInInitializerError
    at test.Test.main(Test.java:29)
   Caused by: org.activiti.engine.ActivitiException: Error parsing XML
    at org.activiti.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java:195)
    at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeployer.java:86)
    at          org.activiti.engine.impl.persistence.deploy.DeploymentManager.deploy(DeploymentManager.java:42)
    at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:68)
    at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:33)
    at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
    at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:61)
    at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:37)
    at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:74)
    at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:134)
    at util.ProcessUtil.<clinit>(ProcessUtil.java:23)
    ... 1 more
Caused by: java.lang.RuntimeException: Could not validate XML with BPMN 2.0 XSD
    at org.activiti.bpmn.converter.BpmnXMLConverter.convertToBpmnModel(BpmnXMLConverter.java:230)
    at org.activiti.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java:181)
    ... 11 more
Caused by: org.xml.sax.SAXParseException: The prefix "xsi" for attribute "xsi:type" associated with an element type "conditionExpression" is not bound.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:334)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2756)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
    at     com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.jaxp.validation.StreamValidatorHelper.validate(StreamValidatorHelper.java:147)
    at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:111)
    at javax.xml.validation.Validator.validate(Validator.java:127)
    at org.activiti.bpmn.converter.BpmnXMLConverter.validateModel(BpmnXMLConverter.java:164)
    at org.activiti.bpmn.converter.BpmnXMLConverter.convertToBpmnModel(BpmnXMLConverter.java:219)

我还想将变量传递给流程定义以对其进行实例化。提前致谢

4

1 回答 1

2

Try adding

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

to the definitions tag.

于 2013-07-30T12:23:13.660 回答