public class ProcessMain {
public static void main(String[] args) {
KieServices ks = KieServices.Factory.get();
KieContainer kContainer = ks.getKieClasspathContainer();
KieBase kbase = kContainer.getKieBase("kbase");
RuntimeManager manager = createRuntimeManager(kbase);
RuntimeEngine engine = manager.getRuntimeEngine(null);
KieSession ksession = engine.getKieSession();
ksession.getWorkItemManager().registerWorkItemHandler("Service Task", new ServiceTaskHandler());
InputData InputData = new InputData("123","23");
Map<String, Object> param = new HashMap<String, Object>();
param.put("in", InputData);
ksession.startProcess("com.sample.bpmn.hello2",param);
// ksession.startProcess(“ com.sample.test”); manager.disposeRuntimeEngine(engine);
System.exit(0);
}
private static RuntimeManager createRuntimeManager(KieBase kbase) {
JBPMHelper.startH2Server();
JBPMHelper.setupDataSource();
EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa");
RuntimeEnvironmentBuilder builder = RuntimeEnvironmentBuilder.Factory.get()
.newDefaultBuilder().entityManagerFactory(emf)
.knowledgeBase(kbase);
return RuntimeManagerFactory.Factory.get()
.newSingletonRuntimeManager(builder.get(), "com.sample:example:1.0");
}
}
线程“ main”中的异常java.lang.RuntimeException:创建KieBase [消息[id = 1,kieBase = kbase,level = ERROR,path = sample2.bpmn,line = -1,column = 0]时出错 text =无法解析xml:异常类java.lang.NullPointerException:空]]
当我在BPMN中创建服务时,它运行良好。 但是当我再创建一个服务任务时,会遇到Null point错误。 似乎是解析的xml异常。我找不到该异常。谢谢。