1

I first came across the following error in Tomcat7 log:

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

I learned that I am potentially missing 3rd party .jars so I added them to my project in NetBeans (right click Project > Properties > Libraries > Add JAR). I rebuilt the WAR file and deployed the project again in Tomcat7 server. But I am still getting similar errors.

Then I came across this question where someone suggests configuring the .jars in web.xml, which leads me to my main question: How do I reference 3rd party .jars in my web.xml?

The full error log is below. Any help/guidance is appreciated. Thank you.

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)
Community
  • 1
  • 1
kaoscify
  • 1,743
  • 7
  • 37
  • 74
  • 1
    You'll need more info. A NullPointerException can mean anything. Typically a missing jar is manifest by a ClassNotFound exception. Your 3rd party jars typically belong in the WEB-INF/lib directory. – Will Hartung Apr 08 '15 at 03:14
  • @WillHartung – Yes, correct. I checked WEB-INF/lib and that’s where the 3rd party `.jars` are. How do I debug this issue further? Finding more information. I don’t know where else to check. – kaoscify Apr 08 '15 at 03:16
  • You'd have to look at the XYZ code, see what it's expecting at line 42 of ConnectPool. – Will Hartung Apr 08 '15 at 03:57
  • @WillHartung – It returns `dataSource.getConnection()` on line 42. `dataSource` points to a path: `java:/comp/env/jdbc/projectname`. Does the path need to be updated? Obviously I did not write this code and need some help understanding it. Thanks for your help so far. – kaoscify Apr 08 '15 at 04:49
  • There's something wrong with your JNDI path (that java:.. thing). That lookup is failing. You need to look up how to properly configure a data source for your servlet container to that path. – Will Hartung Apr 08 '15 at 05:16
  • @WillHartung – Ok, thanks. Going to look into it. – kaoscify Apr 08 '15 at 05:23

0 Answers0