You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by HarleyGuy <ru...@gmail.com> on 2008/10/29 15:31:45 UTC

java.lang.NullPointerException: Module 'null' not found.

Forgive 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
this form 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:


[code]

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)


[/code]



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.


Here is my struts 1.3.8 config file.


[code]
<?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>


[/code]



This is my addPerson JSP

[code]
<%@ 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>

[/code]


This is my index.jsp

[code]
<%@ 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>
[/code]


This is my web.xml file. 



[code]
<?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>
[/code]

When I go lok at the tomcat logs I see this:

[code]
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]
[/code]


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 my first Struts
application I am accomplishing from the beginning, so I am a little
rusty.....

Thank you in advance for taking the time in reading my post. Any comments
would be greatly appreciated.

-- 
View this message in context: http://www.nabble.com/java.lang.NullPointerException%3A-Module-%27null%27-not-found.-tp20228347p20228347.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org