Java Servlet Problem

  • hallo!

    ich habe ein problem mit einer java webapp (servlets) mit postgres datenbankanbindung. wann immer ich auf die datenbank zugreifen will, bekomme ich eine nullpointerexception (in zeile 569):

    die line 569 im servlet schaut so aus:

    Code
    Statement queryTests = ((Connection)(this.getServletContext().getAttribute("connection"))).createStatement();
    Code
    java.lang.NullPointerException 	at Website.Summary.showSummary(Summary.java:569) 	at Website.Summary.processRequest(Summary.java:102) 	at Website.Summary.doGet(Summary.java:790) 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 	at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source) 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 	at java.lang.reflect.Method.invoke(Method.java:585) 	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244) 	at java.security.AccessController.doPrivileged(Native Method) 	at javax.security.auth.Subject.doAsPrivileged(Subject.java:517) 	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276) 	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:262) 	at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:192) 	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:171) 	at java.security.AccessController.doPrivileged(Native Method) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:167) 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874) 	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) 	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) 	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) 	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) 	at java.lang.Thread.run(Thread.java:595)

    ich dachte zuerst dass er den treiber nicht findet, habe aber im catalina home unter shared/lib die postgres.jar von der jdbc-homepage von postgres.

    hat jemand da eine idee?

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!