0

我正在尝试使用在远程服务器中创建的 de .jar 文件来运行 Jbpm 项目。

在我的旧项目中,我使用 .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;
    }

那是可能的??我如何创建运行时环境?

4

1 回答 1

1

看看如何在 maven repo 上从 jar 中创建 ksession:

https://github.com/krisv/jbpm-evaluation-examples/blob/master/kjar-from-guvnor/src/main/java/org/jbpm/evaluation/EvaluationExampleKJarFromGuvnor.java

于 2014-10-02T23:33:29.597 回答