java.lang.NullPointerException: Module 'null' not found.原文來源:
http://perfectplan.iteye.com/blog/1565138Java代碼
嚴(yán)重: 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.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:108)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:75)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.Jspjava.lang.NullPointerException: Module 'null' not found.ServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
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:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
異常起源:
一、初學(xué)Struts時 手動配置Struts的各項環(huán)境需求。并且想在index.jsp中手寫<html:text>等Struts標(biāo)簽
在Struts-config.xml 配置好了一切之后,配置web.xml的Struts ActionServlet 代碼如下:
Java代碼
<p><servlet></p><servlet-name>MyAction</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>MyAction</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
二、配置和好后,程序無任何語法異常。但是在我打開index.jsp頁面的時候程序拋出了空指針異常
java.lang.NullPointerException: Module 'null' not found.拋出這個異常的時候我們知道這是由于Tomcat并未加載
ActionServlet 以致Jsp界面使用Struts中的<html:text property="">程序拋出異常
異常延伸:
一、這個異常就牽扯到web.xml 的<load-on-startup></load-on-startp>
二、那么這個標(biāo)簽有什么用了?
這個標(biāo)簽有著很重要的用途<load-on-startup>(在這里可以放置0-5之間的整數(shù))</load-on-startp>
三、0-5 是web容器控制Tomcat告訴Tomcat按怎樣的順序去執(zhí)行init()方法加載Servlet(程序中可能會有多個Serlvet)如果沒有在web.xml中使用這個標(biāo)簽或者參數(shù)的為負(fù)數(shù) 那么Tomcat將不自動加載這個Servlet。上訴錯誤就是因
為沒有在web.xml中配置<load-on-startup>標(biāo)簽
四、另外<load-on-startup>中的參數(shù)越小那么優(yōu)先級也就越高