如何在web.xml中引用.jars?

时间:2015-04-08 03:10:09

标签: java xml servlets jar tomcat7

我首先在Tomcat7日志中遇到以下错误:

SEVERE: Servlet.service() for servlet [XYZ] in context with path [] threw exception

learned that我可能错过第三方.jars所以我将它们添加到NetBeans中的项目中(右键单击Project > Properties > Libraries > Add JAR)。我重建了WAR文件,并在Tomcat7服务器中再次部署了该项目。但我仍然遇到类似的错误。

然后我遇到this question有人建议在.jars中配置web.xml,这引出了我的主要问题:我如何引用我的第三方.jars的web.xml吗

完整的错误日志如下。任何帮助/指导表示赞赏。谢谢。

SEVERE: Servlet.service() for servlet [XYZ] in context with path [] threw exception
java.lang.NullPointerException
        at com.xyz.data.ConnectPool.getConnection(ConnectPool.java:42)
        at com.xyz.data.xyzDB.getXYZ(xyzDB.java:23)
        at com.xyz.servlets.XYZServlet.processRequest(XYZServlet.java:42)
        at com.xyz.servlets.XYZServlet.doGet(XYZServlet.java:67)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

0 个答案:

没有答案