Qingwen Wei
Qingwen Wei

Reputation: 11

How to integrate OpenIMAJ with Restful web service?

I am using eclipse to work with OpenIMAJ and I would like to integrate OpenIMAJ with a RESTful Web Service.

When I try to run OpenIMAJ project on a RESTful web service

SEVERE: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
java.lang.NoClassDefFoundError: org/openimaj/image/Image
    at edu.carleton.comp4905.main.Index.hello(Index.java:30)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)

Upvotes: 0

Views: 223

Answers (1)

Jon
Jon

Reputation: 841

From the error, it is clear that you have not got the OpenIMAJ jar files included in the class path of your web-app. Without more details of how you've configured eclipse, it is difficult to say exactly what you should do, however, I'd strongly recommend that you just let Maven handle all the dependencies for you as manually trying to include the OpenIMAJ jars is incredibly tedious (see here for a discussion).

You should be able to upgrade your existing eclipse project to use maven by following these instructions: http://aykutakin.wordpress.com/2013/12/04/create-eclipse-dynamic-web-project-with-maven-2/

You can then edit the pom file and add the required web service dependencies (I'd guess from the error you're using the Jersey JAX-RS implementation? if so, instructions here: https://jersey.java.net/documentation/latest/modules-and-dependencies.html). Then add the required OpenIMAJ dependencies to the pom & you should be good to go.

Upvotes: 0

Related Questions