连接到工作项存储库时出错

时间:2015-04-15 15:43:36

标签: jbpm

我在尝试连接到jBPM 6.1.0.Final工作台中的自定义工作项存储库时遇到此异常:

2015-04-15 17:03:07,712 ERROR [io.undertow.request] (default task-24) UT005023: Exception handling request to /jbpm-console/jbpmservicerepo: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map
        at org.jbpm.process.workitem.WorkItemRepository.getWorkDefinitions(WorkItemRepository.java:38) [jbpm-flow-builder-6.1.0.Final.jar:6.1.0.Final]
        at org.jbpm.designer.web.server.JbpmServiceRepositoryServlet.doPost(JbpmServiceRepositoryServlet.java:110) [jbpm-designer-backend-6.1.0.Final.jar:6.1.0.Final]

导致此错误的wid文件是:

import org.drools.core.process.core.datatype.impl.type.StringDataType;

[ 
    [
        "name" : "CustomWorkItem",
        "description" : "Custom Work Item description",
        "parameters" : [],
        "results" : [
            "result_out" : new StringDataType(),
        ],
        "displayName" : "Custom Work Item",
        "icon" : "defaultservicenodeicon.png",
        "category" : "Service",
        "defaultHandler" : "com.example.CustomWorkItemHandler",
        "dependencies" : []
    ]
]

1 个答案:

答案 0 :(得分:0)

异常是由wid文件中的空parameters部分引起的,正如我们在jbpm-flow-builder sources中看到的那样:

            Map<String, DataType> parameterMap = (Map<String, DataType>) workDefinitionMap.get("parameters");
            if (parameterMap != null) {
                for (Map.Entry<String, DataType> entry : parameterMap.entrySet()) {
                    parameters.add(new ParameterDefinitionImpl(entry.getKey(), entry.getValue()));
                }
            }

删除空parameters部分工作台将加载存储库:

import org.drools.core.process.core.datatype.impl.type.StringDataType;

[ 
    [
        "name" : "CustomWorkItem",
        "description" : "Custom Work Item description",
        "results" : [
            "result_out" : new StringDataType(),
        ],
        "displayName" : "Custom Work Item",
        "icon" : "defaultservicenodeicon.png",
        "category" : "Service",
        "defaultHandler" : "com.example.CustomWorkItemHandler",
        "dependencies" : []
    ]
]