我最近在Wildfly 8.2容器中部署了JBPM Console 6.2.0。
基于Web的应用程序似乎运行良好 - WildFly和jbpm-console。我使用本教程部署了控制台:http://mswiderski.blogspot.com/2015/03/jbpm-62-installation-and-upgrade-from.html。
我还没有配置持久性,也没有添加数据源,因为我只是试图先运行这个简单的例子。
我正在使用Java SE Runtime Environment 1.7.0_65-b17在虚拟64位Ubuntu服务器上运行所有这些。
当我将项目作为Junit测试运行时,我得到以下内容:
org.jbpm.process.builder.ProcessBuilderFactoryServiceImpl.newProcessBuilder(Lorg/drools/compiler/compiler/PackageBuilder;)Lorg/drools/compiler/compiler/ProcessBuilder;
at org.drools.compiler.compiler.ProcessBuilderFactory.newProcessBuilder(ProcessBuilderFactory.java:11)
at org.drools.compiler.compiler.PackageBuilder.createProcessBuilder(PackageBuilder.java:408)
at org.drools.compiler.compiler.PackageBuilder.<init>(PackageBuilder.java:346)
at org.drools.compiler.compiler.PackageBuilder.<init>(PackageBuilder.java:242)
at org.drools.compiler.builder.impl.KnowledgeBuilderFactoryServiceImpl.newKnowledgeBuilder(KnowledgeBuilderFactoryServiceImpl.java:40)
at org.kie.internal.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:46)
at org.jbpm.runtime.manager.impl.SimpleRuntimeEnvironment.<init>(SimpleRuntimeEnvironment.java:92)
at org.jbpm.runtime.manager.impl.SimpleRuntimeEnvironment.<init>(SimpleRuntimeEnvironment.java:86)
at org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder.<init>(RuntimeEnvironmentBuilder.java:82)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at org.kie.api.runtime.manager.RuntimeEnvironmentBuilder$Factory.<clinit>(RuntimeEnvironmentBuilder.java:41)
at com.sample.ProcessTest.testProcess(ProcessTest.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
我的Java代码在这里(崩溃在environment = RuntimeEnvironmentBuilder.Factory.get()
):
package com.sample;
import org.jbpm.test.JbpmJUnitBaseTestCase;
import org.junit.Test;
import org.kie.api.KieBase;
import org.kie.api.io.ResourceType;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.manager.RuntimeEngine;
import org.kie.api.runtime.manager.RuntimeEnvironment;
import org.kie.api.runtime.manager.RuntimeEnvironmentBuilder;
import org.kie.api.runtime.manager.RuntimeManager;
import org.kie.api.runtime.manager.RuntimeManagerFactory;
import org.kie.api.runtime.process.ProcessInstance;
import org.kie.internal.io.ResourceFactory;
import org.kie.internal.runtime.manager.context.EmptyContext;
import org.kie.internal.utils.KieHelper;
/**
* This is a sample file to test a process.
*/
public class xx extends JbpmJUnitBaseTestCase {
@Test
public void testProcess() {
KieHelper kieHelper = new KieHelper();
RuntimeEnvironment environment = null;
environment = RuntimeEnvironmentBuilder.Factory.get()
.newDefaultInMemoryBuilder()
.addAsset(ResourceFactory.newClassPathResource("sample.bpmn2"), ResourceType.BPMN2)
.addEnvironmentEntry("IS_JTA_TRANSACTION", false).get();
RuntimeManager manager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);
RuntimeEngine runtime = manager.getRuntimeEngine(EmptyContext.get());
RuntimeEngine engine = manager.getRuntimeEngine(EmptyContext.get());
KieSession ksession = engine.getKieSession();
ProcessInstance processInstance = ksession.startProcess("com.sample.bpmn.hello");
// check whether the process instance has completed successfully
assertProcessInstanceCompleted(processInstance.getId(), ksession);
assertNodeTriggered(processInstance.getId(), "Hello");
manager.disposeRuntimeEngine(engine);
manager.close();
ksession.dispose();
}
}
这是我的pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hellojbpm</groupId>
<artifactId>hellojbpm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source />
<target />
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-ext</artifactId>
<version>1.7.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-audit</artifactId>
<version>6.2.0.Final</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>6.2.0.Final</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-runtime-manager</artifactId>
<version>6.2.0.Final</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-flow-builder</artifactId>
<version>6.2.0.Final</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-flow</artifactId>
<version>6.2.0.Final</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>6.2.0.Final</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-internal</artifactId>
<version>6.2.0.Final</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>