My connector fails, using resteasy-jaxrs

1
0
-1

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:

  1. package org.mycompany.connector;
  2.  
  3. import org.bonitasoft.engine.connector.ConnectorException;
  4. import org.jboss.resteasy.client.ClientRequest;
  5.  
  6. public class MyAktionConnectorImpl extends AbstractMyAktionConnectorImpl {
  7.  
  8. @Override
  9. protected void executeBusinessLogic() throws ConnectorException{
  10. int apiResponseCode = 0;
  11. ClientRequest request = new ClientRequest("http://localhost:8081/my-aktion/rest/donate/1"); //this line is causing the Exception
  12. apiResponseCode = 1;
  13. setMyAktionResponse(Integer.toString(apiResponseCode));
  14. }

The exception:

Exception

  1. java.lang.reflect.InvocationTargetException
  2. 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:

  1. package org.mycompany.connector;
  2.  
  3. import org.bonitasoft.engine.connector.ConnectorException;
  4. import org.jboss.resteasy.client.ClientRequest;
  5.  
  6. public class MyAktionConnectorImpl extends AbstractMyAktionConnectorImpl {
  7.  
  8. @Override
  9. protected void executeBusinessLogic() throws ConnectorException{
  10. int apiResponseCode = 0;
  11. org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor a = new org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor(); //this line is now causing the Exception
  12. apiResponseCode = 1;
  13. setMyAktionResponse(Integer.toString(apiResponseCode));
  14. }

This is how the Excpetion changed:

  1. java.lang.reflect.InvocationTargetException
  2. 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.

No answers yet.
Testing
Notifications