我尝试使用在远程服务器中创建的de .jar文件来运行Jbpm Project。
在我的旧项目中,我使用.bpmn文件创建了我的RuntimeEnvironment ...
@Produces
@Singleton
@PerProcessInstance
@PerRequest
public RuntimeEnvironment produceEnvironment(EntityManagerFactory emf) throws IOException {
RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get()
.newDefaultBuilder()
.entityManagerFactory(emf)
.addAsset(
ResourceFactory
.newClassPathResource("rewards-basic.bpmn"),
ResourceType.BPMN2).get();
return environment;
}
工作正常。
但现在我想使用远程存储库中的.jar。 例如:
@Produces
@Singleton
@PerProcessInstance
@PerRequest
public RuntimeEnvironment produceEnvironment(EntityManagerFactory emf) throws IOException {
String url = "http://server:8080/jbpm-console/maven2/group/testHtmlForms/1.0/testHtmlForms-1.0.jar";
KieServices ks = KieServices.Factory.get();
KieRepository kr = ks.getRepository();
UrlResource urlResource = (UrlResource) ks.getResources()
.newUrlResource(url);
urlResource.setUsername("admin");
urlResource.setPassword("admin");
urlResource.setBasicAuthentication("enabled");
InputStream is = urlResource.getInputStream();
KieModule kModule = kr.addKieModule(ks.getResources()
.newInputStreamResource(is));
KieContainer kContainer = ks.newKieContainer(kModule.getReleaseId());
RuntimeEnvironment environment = ????????
return environment;
}
那可能吗?我如何创建RuntimeEnvironment?
答案 0 :(得分:1)