• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.NullPointerException in a simple servlet

 
matt love
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having difficulty with a simple servlet.

If I utilize org.apache.struts.action.ActionServlet in the web-app/servlet/servlet-class attribute, then the welcome-file comes up fine.

If I use my own servlet, servlet2, then I get
“SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException: Module 'null' not found.”, and a blank page.

Using a println, I know servlet2.init() method is firing ok.

It looks to me, a newbie, that the container can’t find a moduleConfig object. But, neither GenericServlet or HttpServlet reference this module. And my servlet doesn’t reference it. ActionServlet does provide a method which returns this object.

I included ActionServlet’s getModuleConfig(HttpServletRequest request) in my servlet, but received the same result. Based upon the println, control doesn’t reach this method anyway.

Code is below.

As an aside, do the parentheses in “return (config);” have any significance?

Many thanks.

Matt

loginPackage.servlet2.java



--------------------------------------------
Web.xml
--------------------------------------------
struts-config
--------------------------------------------
stack trace
Feb 22, 2010 3:52:28 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException: Module 'null' not found.
at org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
at org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)
at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:818)
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:488)
at org.apache.jsp.login_jsp._jspx_meth_html_005fform_005f0(login_jsp.java:168)
at org.apache.jsp.login_jsp._jspService(login_jsp.java:100)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
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.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:128)
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:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64958
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.

Also, please UseCodeTags.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you accessing the page with the Struts form on it? If you're not getting there via an action, you'll get any of several errors; I can't remember which at this point.

Why are you writing a replacement action servlet? Heck, why are you using Struts 1.0 (or 1.1, can't tell)? Why do you have TLD definitions in the web.xml, are you running on a very old container?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic