Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet throws Unload Exception  RSS feed

 
Mohini Dhanaskar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help me out,i started learning java few months ago.

SEVERE: Servlet EmailFormatServlet threw unload() exception
javax.servlet.ServletException: Servlet.destroy() for servlet EmailFormatServlet threw exception
at org.apache.catalina.core.StandardWrapper.unload(StandardWrapper.java:1413)
at org.apache.catalina.core.StandardWrapper.stop(StandardWrapper.java:1739)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4601)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3222)
at org.apache.catalina.manager.ManagerServlet.reload(ManagerServlet.java:943)
at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:361)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:199)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:558)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
at EmailFormatServlet.destroy(EmailFormatServlet.java:27)
at org.apache.catalina.core.StandardWrapper.unload(StandardWrapper.java:1394)
... 23 more
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Obviously something is null on which you are invoking some method.
So you want to show us your EmailFormatServlet #destroy() ?
 
Mohini Dhanaskar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir,this is my servlet code.


 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In future, while posting code, please UseCodeTags I have added them this time for you. As you can see they make the code much more easier to read and understand

As per your stack trace the NullPointerException originated on line 27 of your code. viz.

That would indicate that the variable ps is null. Just put a null check before you invoke a method on it.

This is not really a servlet question. Moving to a more appropriate forum
 
Campbell Ritchie
Marshal
Posts: 56187
171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and we can see that[ttt ps [/tt]was previously initialised to null. You ought to initialise it to something useful and correct, then it will work
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!