- This topic has 7 replies, 2 voices, and was last updated 16 years, 1 month ago by Russ.
-
AuthorPosts
-
RussMemberForgive me for posting a topic that seems to be answered already in this forum. I am not able to correct this fault using the information provided in other forms and FAQ sections.
This is a basic tutorial example of a struts project I have created. It consist of one jsp, one Form and Action class. However, typing in the URL http://localhost:8080/strutsproject I recieve the following fault:
java.lang.NullPointerException: Module 'null' not found. org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755) org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:364) org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:285) org.apache.struts.taglib.logic.RedirectTag.generateRedirectURL(RedirectTag.java:289) org.apache.struts.taglib.logic.RedirectTag.doEndTag(RedirectTag.java:268) org.apache.jsp.index_jsp._jspx_meth_logic_005fredirect_005f0(index_jsp.java:115) org.apache.jsp.index_jsp._jspService(index_jsp.java:87) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
What I have done to correct this problem myself:
1. Verify all the dependent jar files are in the lib directory within the war file.
2. I reviewed the struts-config.xml file.
3. Ensure I was using J2EE 1.4Here is my struts 1.3.8 config file.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd"> <struts-config> <form-beans> <form-bean name="addPersonForm" type="russ.home.struts.AddPersonForm"> </form-bean> </form-beans> <global-exceptions /> <global-forwards /> <action-mappings> <action path="/addPerson.do" type="russ.home.struts.AddPersonAction" name="addPersonForm" input="/addPerson.jsp" scope="request" > <forward name="success" path="/success.html" /> <forward name="failure" path="/failure.html" /> </action> </action-mappings> <message-resources parameter="russ.home.struts.MessageResources" /> </struts-config>
This is my addPerson JSP
<%@ page language="java" contentType="text/html" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html:html> <head> <html:base /> <title>Submit Example</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body bgcolor="white"> <logic:notPresent name="org.apache.struts.action.MESSAGE" scope="application"> ERROR: Application resources not loaded -- check servlet container logs for error messages. </logic:notPresent> <html:form action="/addPerson.do" method="post" focus="lastName"> <table border="0"> <thead> <tr align="center"> <td colspan="6"><strong>Example Submit Page</strong></td> </tr> </thead> <tbody> <tr align="left"> <td align="right" colspan="1">Last Name:</td> <td align="left" colspan="1"> <html:text property="lastName" /></td> <td align="right" colspan="1"><html:errors property="lnameErrors" /></td> <td align="right" colspan="1">First Name:</td> <td align="left" colspan="1"><html:text property="firstName" /></td> <td colspan="2"><html:errors property="fnameErrors" /></td> </tr> <tr> <td align="right" colspan="1">Address:</td> <td align="left" colspan="2"><html:textarea property="address" /></td> <td align="left" colspan="2"><html:errors property="addressErrors" /></td> </tr> <tr align="left"> <td align="right" colspan="1">Sex:</td> <td colspan="1" align="right"><html:radio value="Male" property="sex" name="male">Male</html:radio></td> <td colspan="1" align="right"><html:radio value="Female" property="sex" name="female">Female</html:radio></td> <td colspan="2" align="left"><html:errors property="sexErrors" /></td> </tr> <tr align="left"> <td align="right" colspan="1">Marital Status:</td> <td align="right" colspan="1"><html:checkbox value="Single" property="maritalStatus" name="married">Single</html:checkbox></td> <td align="right" colspan="1"><html:checkbox value="Married" property="maritalStatus" name="single">Married</html:checkbox></td> <td colspan="2"><html:errors property="marriedErrors" /></td> </tr> <tr align="left"> <td align="right" colspan="1">Age:</td> <td align="center" colspan="1"> <select name="age"> <option value="a">---</option> <option value="b">0-19</option> <option value="c">20-29</option> <option value="d">30-39</option> <option value="e">40-49</option> <option value="f">50--</option> </select> </td> <td colspan="1" align="left"></td> <td colspan="2" align="left"><html:errors property="marriedErrors" /></td> </tr> </tbody> <tfoot> <tr align="left"> <td colspan="2" align="center"><html:submit /></td> <td colspan="1" align="center"></td> <td colspan="2" align="center"><html:reset /></td> </tr> </tfoot> </table> </html:form> </body> </html:html>
This is my index.jsp
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <logic:redirect forward="addPerson"/> </body> </html>
This is my web.xml file.
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <!-- Standard Action Servlet Configuration (with debugging) --> <servlet> <servlet-name>action</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> <init-param> <param-name>validating</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>3</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>3</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <!-- Standard Action Servlet Mapping --> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>/do/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>
When I go lok at the tomcat logs I see this:
DEBUG http-8080-1 org.apache.struts.util.PropertyMessageResources - Initializing, config='org.apache.struts.taglib.logic.LocalStrings', returnNull=true INFO http-8080-1 org.apache.struts.util.PropertyMessageResources - Operating in Default mode [null] DEBUG http-8080-1 org.apache.struts.util.PropertyMessageResources - Initializing, config='org.apache.struts.taglib.LocalStrings', returnNull=true INFO http-8080-1 org.apache.struts.util.PropertyMessageResources - Operating in Default mode [null]
I am getting the destinct impression that the ActionServlet is not loading. I do not see it in the Tomcat logs or within the console stating the ActionServlet init() has been called. I have used the blank Struts war file that comes with the distribution. I can get this project to work. I have compared the libraries and the two projects are the same. I have read the JavaRanch forum for suggestions and FAQ. I can not see where this error is coming from…..
Any suggestions would be greatly appreciated. This is a simple Struts application I am accomplishing, so I am a little rusty….. I have attempted to attach the source code to the struts jar files. The IDE is bringing up version 1.2.4 and the jars/source code I am using is 1.3.8, so I am a little confused………
Thank you in advance for taking the time in reading my post. Any comments would be greatly appreciated.
Loyal WaterMemberrussray,
I don’t know the solution to this issue but I’ll check with the dev team. I think you would be better off posting this on the struts forums as well.
Loyal WaterMemberYou could check this thread out as well:-
http://www.mail-archive.com/user@struts.apache.org/msg52223.htmlDid you create the project from scratch using MyEclipse?
RussMemberOkay…….I think there must be something wrong……..Not pointing a finger at ME yet….but I have tried creating a structs project two ways……… The first is my way without using wizards….. The second way I am using the wizzards. In either case, the same type of error is showing up. I am using this tutorial http://www.laliluna.de/first-steps-using-struts-tutorial.html
Each time I am get the error:
Oct 30, 2008 3:07:16 PM org.apache.jasper.compiler.TldLocationsCache processWebDotXml WARNING: Internal Error: File /WEB-INF/web.xml not found Oct 30, 2008 3:07:18 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.logic.ForwardTag.doEndTag(ForwardTag.java:84) at org.apache.jsp.index_jsp._jspx_meth_logic_005fforward_005f0(index_jsp.java:104) at org.apache.jsp.index_jsp._jspService(index_jsp.java:72) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337) 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:233) 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:102) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619)
I am using ME 7.0 M2. Theses are web projects using J2EE 1.4 standard. Suggestions?
Russ
RussMemberOKay I’ve gone digging into the Struts code and discovered
This is the code for this portion of the stack trace:
STACKTRACE at org.apache.struts.taglib.logic.ForwardTag.doEndTag(ForwardTag.java:84)
/** * Look up the ActionForward associated with the specified name, and * perform a forward or redirect to that path as indicated. * * @throws JspException if a JSP exception has occurred */ public int doEndTag() throws JspException { // Look up the desired ActionForward entry ActionForward forward = null; ModuleConfig config = TagUtils.getInstance().getModuleConfig(pageContext);
I am assuming the pageContext provided to the getModuleConfig method is returning a null.
Suggestions?
Russ
RussMemberI still believe the ActionServlet is not getting started……. This is the console log
Oct 31, 2008 9:37:30 AM org.apache.jasper.compiler.TldLocationsCache processWebDotXml WARNING: Internal Error: File /WEB-INF/web.xml not found Oct 31, 2008 9:37:32 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet jsp threw exception
Loyal WaterMemberThis is really a struts issue and/or an issue with that tutorial and you need to contact the author for suggestions. It’s possible that something changed in Struts between the time that tutorial was written and now with the 1.3.8 release, but I don’t have any immediate suggestions for you.
RussMemberI have moved to the latest version of Tomcat and I turned on xml validation. It appears that tomcat is looking for the taglib within the web.xml and can not find it…….
SEVERE: Parse Error at line 22 column 19: cvc-elt.1: Cannot find the declaration of element 'taglib'. org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'taglib'.
The web.xml is being created by ME.
-
AuthorPosts