I get a "java.lang.NoClassDefFoundError: com/hp/hpl/jena/shared/BadURIException" when running a very simple servlet. The error points back to the initialisation of the "Tagger" class. The code is as follows
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import my.package.Tagger;
public class NormaliserServlet extends HttpServlet{
public void doGet(HttpServletRequest req, HttpServletResponse response) throws IOException{
Tagger pot = new Tagger("");
response.setContentType("text");
PrintWriter out = response.getWriter();
out.println("hello");
out.println(pot.someMethod());
out.close();
this.log("Request for normaliser");
}
}
The war file contains the jar file defining "Tagger" in WEB-INF/lib and a similar invocation works outside of a servlet. I can't seem to find what the problem would be. The web.xml is pretty standard too:
<servlet>
<servlet-name>normalise</servlet-name>
<servlet-class>NormaliserServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>normalise</servlet-name>
<url-pattern>/normalise</url-pattern>
</servlet-mapping>
I'm using winstone as the servlet container, but i get the exact same error in tomcat. The stacktrace is:
java.lang.NoClassDefFoundError: com/hp/hpl/jena/shared/BadURIException
at NormaliserServlet.doGet(NormaliserServlet.java:13)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:104)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:45)
at winstone.ServletConfiguration.execute(ServletConfiguration.java:249)
at winstone.RequestDispatcher.forward(RequestDispatcher.java:335)
at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:244)
at winstone.RequestHandlerThread.run(RequestHandlerThread.java:150)
at java.lang.Thread.run(Thread.java:619)