My connector fails: using resteasy-jaxrs

Dear Community,

my version of Bonita BPM: Bonita BPM Community Edition Version : 6.2.4

I’m trying to implement a “Donation Task” in BonitaBPM which posts a donation using a donation-service. This RESTful service is running on my local machine on a JBoss AS.

My goal is to implement a connector which calls the donation-service using this maven-dependency: “org.jboss.resteasy:resteasy-jaxrs:2.2.1.GA”. Obviously it is not possible to add Maven-Dependencies to BonitaBPM, therefore i added all .jar-Files from that dependency to the connector.

resteasy dependencies

The problem is that the connector fails already in the beginning, when i’m just initializing the class ClientRequest.

My code:

package org.mycompany.connector;

import org.bonitasoft.engine.connector.ConnectorException;
import org.jboss.resteasy.client.ClientRequest;

public class MyAktionConnectorImpl extends AbstractMyAktionConnectorImpl {

@Override
protected void executeBusinessLogic() throws ConnectorException{
	int apiResponseCode = 0; 
	ClientRequest request = new ClientRequest("http://localhost:8081/my-aktion/rest/donate/1"); //this line is causing the Exception
	apiResponseCode = 1; 
	setMyAktionResponse(Integer.toString(apiResponseCode));
 }

The exception:

Exception

java.lang.reflect.InvocationTargetException org.bonitasoft.engine.bpm.connector.ConnectorExecutionException: org.bonitasoft.engine.core.connector.exception.SConnectorException: org.bonitasoft.engine.core.connector.exception.SConnectorException: org.bonitasoft.engine.connector.exception.SConnectorException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor

Then i tried to analyse this Exception. I found there is a java.lang.ClassNotFoundException so i tried just to initialize the org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor.

I changed my code a little bit:

package org.mycompany.connector;

import org.bonitasoft.engine.connector.ConnectorException;
import org.jboss.resteasy.client.ClientRequest;

public class MyAktionConnectorImpl extends AbstractMyAktionConnectorImpl {

@Override
protected void executeBusinessLogic() throws ConnectorException{
	int apiResponseCode = 0; 
	org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor a = new org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor(); //this line is now causing the Exception
	apiResponseCode = 1; 
	setMyAktionResponse(Integer.toString(apiResponseCode));
 }

This is how the Excpetion changed:

java.lang.reflect.InvocationTargetException org.bonitasoft.engine.bpm.connector.ConnectorExecutionException: org.bonitasoft.engine.core.connector.exception.SConnectorException: org.bonitasoft.engine.core.connector.exception.SConnectorException: org.bonitasoft.engine.connector.exception.SConnectorException: java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError

I’m wondering what I’m doing wrong. I tested this code in a default eclipse java project and it works.