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)
异常起源:
一、初学Struts时 手动配置Struts的各项环境需求。并且想在index.jsp中手写<html:text>等Struts标签
在Struts-config.xml 配置好了一切之后,配置web.xml的Struts ActionServlet 代码如下:
<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>
二、那么这个标签有什么用了?
这个标签有着很重要的用途<load-on-startup>(在这里可以放置0-5之间的整数)</load-on-startp>
三、0-5 是web容器控制Tomcat告诉Tomcat按怎样的顺序去执行init()方法加载Servlet(程序中可能会有多个Serlvet)如果没有在web.xml中使用这个标签或者参数的为负数 那么Tomcat将不自动加载这个Servlet。上诉错误就是因
为没有在web.xml中配置<load-on-startup>标签
四、另外<load-on-startup>中的参数越小那么优先级也就越高