reset password
Author Message
abajpai
Posts: 52
Posted 16:19 Apr 09, 2011 |

This just randomly started happening. When I run the server and try to access my root servlet, it gives me a 500 page. In Eclipse, the error console shows the following error:

SEVERE: Servlet.service() for servlet [servlet.DisplayQuestions] in context with path [/CS320Answers] threw exception
java.lang.NullPointerException
    at javax.servlet.GenericServlet.getServletContext(GenericServlet.java:125)
    at servlet.DisplayQuestions.doGet(DisplayQuestions.java:56)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)

 

At first, restarting the server a few times did the trick and I wrote it off to a software bug but now its constant.


No clue why this is happening.

cysun
Posts: 2935
Posted 16:23 Apr 09, 2011 |

Read the error message carefully.

abajpai
Posts: 52
Posted 16:45 Apr 09, 2011 |

I figured it out. The line to upload the data to the servlet context was commented out by mistake. Thanks for the hint professor.

Last edited by abajpai at 19:07 Apr 09, 2011.