I'm trying to create a WebService
that returns me one or more data from the database, using JSON
as a return.
@Path("teste")
@Produces(MediaType.APPLICATION_JSON)
public JSONObject teste() {
JSONObject obj = new JSONObject();
obj.put("teste", "teste 1");
obj.put("teste2", "teste 2");
return obj;
}
But when I run through the URL, the following error occurs: (I just picked up the first few lines):
GRAVE: Servlet.service() for servlet [Jersey REST Service] in context with path [/TrabalhoWeb1] threw exception [org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException] with root cause java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1291) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119) at java.lang.ClassLoader.defineClass1(Native Method)
And when I perform debug , the error occurs when it instantiates the JSONObject
object.
I have no idea what to do.