File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Cannot find ActionMappings or ActionFormBeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Cannot find ActionMappings or ActionFormBeans " Watch "Cannot find ActionMappings or ActionFormBeans " New topic
Author

Cannot find ActionMappings or ActionFormBeans

Tokunbo Oke
Ranch Hand

Joined: Sep 09, 2003
Posts: 57
When I execute a JSP, I get this error:
org.apache.jasper.JasperException: Cannot find
ActionMappings or ActionFormBeans collection
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)

I am using
Tomcat-4.1.27 and struts 1.1.

CLASSPATH IS SET TO:
CLASSPATH=.;D:\Apps\Apache\T
omcat-4.1.27\webapps\wroxapp\WEB-INF\lib\commons-beanutils.jar;D:\Apps\Apache\Tomcat-4.1.27\
webapps\wroxapp\WEB-INF\lib\commons-collections.jar;D:\Apps\Apache\Tomcat-4.1.27\webapps\wroxapp\WEB-INF\lib\commons-digester.jar;D:\Apps\Apache\Tomcat-4.1.27\w
ebapps\wroxapp\WEB-INF\lib\commons-lang.jar;D:\Apps\Apache\Tomcat-4.1.27\webapps\wroxapp\WEB-INF\lib\commons-logging.jar;D:\Apps\Apache\Tomcat-4.1.27\webapps\wroxapp\WEB-INF\lib\commons-validator.jar;D:\Apps\Apache\Tomcat-4.1.27\common\lib\servlet.jar;d:\apps\Oracle\Ora8i\jdbc\lib\classes12.zip;D:\Apps\java\jbActivatnFramewk\activation.jar;D:\Apps\java\javamail-1.3.1\mail.jar

The .jar files in my \webapps\wroxapp\WEB-INF\lib directory are:
commons-beanutils.jar
commons-collections.jar
commons-digester.jar
commons-fileupload.jar
commons-lang.jar
commons-logging.jar
commons-validator.jar
jakarta-oro.jar
struts.jar
struts-legacy.jar

Config files are as follows:
strut-config.xml
================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config
PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-bean
name="lookupForm"
type="ch03.LookupForm"/>
</form-bean>

<action-mappings>
<action path="/Lookup"
type="ch03.LookupAction"
name="lookupForm">
<forward name="success" path="/quote.jsp"/>
<forward name="failure" path="/index.jsp"/>
</action>
</action-mappings>
</struts-config>

web.xml
=======
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<web-app>
<!-- Standard ActionServlet Configuration -->
<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>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Standard ActionServlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<!-- Standard Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
</web-app>
The JSP/STRUTS file I am running is:
====================================
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html>
<head>
<title>Wrox Struts Application</title>
</head>
<body>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td height="68" width="48%">
<div align="left">
<img src="images/wxmainlogowhitespace.gif">
</div>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<html:errors />

<html:form action="Lookup">
<table width="45%" border="0">
<tr>
<td><bean:message key="app.symbol" />:</td>
<td><html:text property="symbol" /></td>
</tr>
<tr>
<td colspan="2" align="center"><html:submit /></td>
</tr>
</table>
</html:form>
</body>
</html>

Can anyone please tell me what is wrong?
Thanks.
Ola (SCJP 1.4)
hal arres
Ranch Hand

Joined: Jan 10, 2003
Posts: 30
Hello,

I am using the same book as you,
Professional Jakarta Struts by James Goodwill and Richard Hightower

and I got the same exception but can't find a solution.

I am using Tomcat 5.0.27
j2sdk1.4.2_04

but maybe this will help you:
in LookupAction.java
if ( form != null ) {
// Use the LookupForm to get the request parameters
LookupForm lookupForm = (LookupForm)form;

String symbol = lookupForm.getSymbol();
price = getQuote(symbol);
}
There is a misspelling.


Please contact me, if you found the solution

mfg Sebastian
[ August 02, 2004: Message edited by: hal arres ]
Nicola Guy
Ranch Hand

Joined: Jun 23, 2004
Posts: 91
I think the form bean has to be enclosed in form-beans tags is

<form-bean
name="lookupForm"
type="ch03.LookupForm">
</form-bean>

becomes

<form-beans>
<form-bean
name="lookupForm"
type="ch03.LookupForm">
</form-bean>
</form-beans>

hope this helps
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot find ActionMappings or ActionFormBeans