Building First Maven Project Error

1
0
-1

Hello,

I'm using Eclipse to build my first maven bonita client project and getting some errors. Using the rest api example project located at
https://github.com/bonitasoft/bonita-examples/tree/master/rest-api-example

This is very confusing because my maven built successfully and the httpclient.jar is located in the Maven Dependencies location.

Please help...

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/clien
t/methods/HttpUriRequest
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.http.client.methods.Http
UriRequest
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 6 more

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ rest-api-example ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.955 s
[INFO] Finished at: 2016-02-17T09:51:14-06:00
[INFO] Final Memory: 12M/191M
[INFO] ------------------------------------------------------------------------

1 answer

1
0
-1

I have an update, but another issue. It looks like the maven dependencies were not being included in the compile jar. So, I used shaded.jar plug in to compile.

Now, I'm getting NullPointerException. I think its on the resources for the Organization.

java -jar rest-api-example-1.0.0-SNAPSHOT.jar

Exception in thread "main" java.lang.NullPointerException
at org.bonitasoft.example.App.importOrganization(App.java:256)
at org.bonitasoft.example.App.start(App.java:138)
at org.bonitasoft.example.App.main(App.java:118)

Below is the code when calling the resource.

/**
* Resource file containing an example of organization
*/
private static final String ORGANIZATION_FILE = "/Management.xml";

private void importOrganization() {

    importOrganizationFromFile(new File(getClass().getResource(ORGANIZATION_FILE).getPath()));

}

Comments

Submitted by mtdonovan on Wed, 02/24/2016 - 20:11

I had incorrect path Added

private static final String ORGANIZATION_FILE = "src/main/resources/ReferenceDataManagement.xml";

and removed the getResource method used the following instead.

importOrganizationFromFile(new File(ORGANIZATION_FILE));

Now I'm getting string out of range.

java.lang.RuntimeException: java.lang.StringIndexOutOfBoundsException: String index out of range: -9
at org.bonitasoft.example.App.extractUserIdFrom(App.java:362)
at org.bonitasoft.example.App.getUserIdFromSession(App.java:347)
at org.bonitasoft.example.App.start(App.java:153)
at org.bonitasoft.example.App.main(App.java:119)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -9
at java.lang.String.substring(String.java:1875)
at org.bonitasoft.example.App.extractUserIdFrom(App.java:358)
... 3 more
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: java.lang.StringIndexOutOfBoundsException: String index out of range: -9
at org.bonitasoft.example.App.getUserIdFromSession(App.java:351)
at org.bonitasoft.example.App.start(App.java:153)
at org.bonitasoft.example.App.main(App.java:119)
Caused by: java.lang.RuntimeException: java.lang.StringIndexOutOfBoundsException: String index out of range: -9
at org.bonitasoft.example.App.extractUserIdFrom(App.java:362)
at org.bonitasoft.example.App.getUserIdFromSession(App.java:347)
... 2 more
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -9
at java.lang.String.substring(String.java:1875)
at org.bonitasoft.example.App.extractUserIdFrom(App.java:358)
... 3 more

Submitted by mtdonovan on Wed, 02/24/2016 - 20:17

Added User to Administrator Group and now getting error 500.

Start Process Build
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Failed : HTTP error code : 500 : Internal Server Error
at org.bonitasoft.example.App.deployProcess(App.java:379)
at org.bonitasoft.example.App.start(App.java:154)
at org.bonitasoft.example.App.main(App.java:119)
Caused by: java.lang.RuntimeException: Failed : HTTP error code : 500 : Internal Server Error
at org.bonitasoft.example.App.ensureStatusOk(App.java:256)
at org.bonitasoft.example.App.extractProcessId(App.java:488)
at org.bonitasoft.example.App.installProcessFromUploadedBar(App.java:483)
at org.bonitasoft.example.App.deployProcess(App.java:371)
... 2 more

Notifications