我正在处理需要一些 .jar 文件的作业。这项任务要求我在一个带有 JSP 文件的 Tomcat servlet 上做一些工作。
我在 Eclipse 的 Java 构建路径中包含了我的 .jar,并将它们复制/添加到 WEB-INF/lib 目录中。
当我像这样运行项目时:http://localhost:8080/project/
我看到index.jsp
带有空 div 的页面,其中数据应该来自通过TestServlet.java
.
寻找原因,我在结帐时看到以下错误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)
这很奇怪,因为我再次将 .jars 包含在 Java Build Path 中,并将 .jars 复制/添加到 WEB-INF/lib 目录中。
有什么想法或帮助吗?