• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.NullPointerException at createStatement  RSS feed

Mario Schwaiger
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am dealing with a Java-Web-Application which works with Hibernate and JDBC (I use BoneCP for the Connection-Pooling) to a MS-SQL-Server 2008.
I use a class to provide the basic-connection (Basicconnection.Java) and a bean to provide some cached values for every session.

As I deploy it it works fine. Can't complain. But after a while an exception is thrown and I'm unable to figure out, why:

Aug 01, 2013 3:00:44 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
at datenbankbohnen.Persistenzen.initialisiere(Persistenzen.java:100)
at org.apache.jsp.Partial.Material.Material_jsp._jspService(Material_jsp.java:112)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:722)

The error occurs in line 22:

The class Basicconnection looks like this:

What am I doing wrong? Could it be a connection timeout? As said, during the first ~10 Minutes everything goes as expected. And then just Null pointers and I'm unable to make it work any more...
Thank you in anticipation!!
Jeanne Boyarsky
author & internet detective
Posts: 37395
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That code looks like it returns null if it can't get a connection after printing a log message. Is there anything in the logs before the null pointer?
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!