0
votes

I'm working on an assignment that requires some .jar files. The assignment requires me to do some work on a Tomcat servlet with JSP files.

I included my .jars in the Java Build Path in Eclipse, and copied/added them to the WEB-INF/lib directory.

When I run the project like so: http://localhost:8080/project/ I see the index.jsp page with empty divs where data should be from the code executed via the TestServlet.java.

Looking for the reason why, I see the following error when I check out http://localhost:8080/project/TestServlet:

May 3, 2013 1:22:26 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [TestServlet] in context with path [/project] threw exception [Servlet execution threw an exception]
with root cause java.lang.ClassNotFoundException: com.aetrion.flickr.FlickrException

    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1713)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558)
    at TestServlet.doGet(TestServlet.java:27)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:680)

Which is weird, since, again, I included the .jars in the Java Build Path and copied/added the .jars to the WEB-INF/lib directory.

Any ideas or help?

3

3 Answers

2
votes

just to be sure, first you put the jar in the web-inf/lib and after you add it in t project > build path > configure build path > add jar , in that order , correct?

try in the "libraries" tab moving the jar at the top or almost the top... would be a problem of visibility

0
votes

You must try to add the jar in your classpath, project > build path > configure build path > add jar (or external jar)

0
votes

Even i had the same problem.This is how I solved it: You can add the external jar to the tomcat folder->lib-> add your external jar in your system ,after adding remove that folder from your project and add again or you can remove the tomcat folder and copy all the jars from tomcat folder->lib and you can add it as your external jars to your project