Ampm
Ampm

Reputation: 27

JBPM 6 configuration with maven

I am developing an application using Jbpm 6 rest api. I am trying to use following code to interact via REST with the remote runtime. // Create REST session

RemoteRestSessionFactory restSessionFactory = new RemoteRestSessionFactory(deploymentId, deploymentUrl, user, password);
RuntimeEngine engine = restSessionFactory.newRuntimeEngine();
KieSession ksession = engine.getKieSession();

I am trying to add jbpm-kie-services with maven in jboss 8.1, but after adding that jar , the application is not deploying. Please can anyone help me to configure above code with Jbpm 6 required maven libraries.

Upvotes: 0

Views: 2013

Answers (3)

Tex
Tex

Reputation: 305

In order to use Remote REST API, you will need to use jboss-deployment-descriptor.xml to import aditional dependencies.

<jboss-deployment-structure>
    <deployment>    
            <dependencies>
                    <module name="org.jboss.resteasy.resteasy-jaxrs" export="true" meta-inf="import" />
                    <module name="org.jboss.resteasy.resteasy-jaxb-provider" export="true" meta-inf="import" />
                    <module name="org.apache.httpcomponents" export="true" meta-inf="import" />
            </dependencies>
    </deployment>  

Your pom.xml file should look like

<dependencyManagement>
<dependencies>
    <dependency>
        <groupId>org.jboss.bom.brms</groupId>
        <artifactId>jboss-javaee-6.0-with-drools</artifactId>
        <version>${version.jboss.bom.brms}</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>
</dependencies>
</dependencyManagement>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-internal</artifactId>
</dependency>   
<dependency>
    <groupId>org.kie.remote</groupId>
    <artifactId>kie-services-client</artifactId>
    <exclusions>
    <exclusion>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxrs</artifactId>
    </exclusion>
    <exclusion>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxb-provider</artifactId>
    </exclusion>
    <exclusion>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jackson-provider</artifactId>
    </exclusion>
    <exclusion>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>jaxrs-api</artifactId>
    </exclusion>
    <exclusion>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
    </exclusion>
    </exclusions>
</dependency>   
<dependency>
    <groupId>org.kie</groupId>
    <artifactId>kie-ci</artifactId>
</dependency>   
<dependency>
    <groupId>org.jbpm</groupId>
    <artifactId>jbpm-audit</artifactId>
</dependency>

Source https://access.redhat.com/solutions/784863

Upvotes: 0

Mike
Mike

Reputation: 832

I started using the remoting api the other day. I used the maven dependency that @Grady G Cooper mentioned, but I received a java.lang.NoSuchMethodError: org.apache.http.auth.AuthState.update error while attempting to connect. This was caused by a dependency issue that I found here. Below is my pom file to get around this issue

<dependency>
    <groupId>org.kie.remote</groupId>
    <artifactId>kie-services-client</artifactId>
       <!--exclude old version causing issue-->
       <exclusions>
        <exclusion>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<!-- add proper versions -->
<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpcore</artifactId>
    <version>4.2.1</version>
</dependency>
<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.2.1</version>
</dependency>

Upvotes: 0

Grady G Cooper
Grady G Cooper

Reputation: 1064

You may want to use the kie.remote client:

        <dependency>
          <groupId>org.kie.remote</groupId>
          <artifactId>kie-services-client</artifactId>
          <version>${jbpm.version}</version>
       </dependency>

Upvotes: 1

Related Questions