• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot find ActionMappings or ActionFormBeans collection

 
swapna arava
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I got the following exceptions when i am deploying the application using jboss4.2:

Iam using strts validation frame work for both client and serverside validations.But i am getting this errors.that to it is not supporting taglib directives when i am using those.
But i have copied all jar files web-inf and tab files in lib.
Please help me in this issues, i stucked with this since 3 days..

1.Cannot find ActionMappings or ActionFormBeans collection
2.javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
3.javax.servlet.UnavailableException: Parsing error processing resource path /WEB-INF/struts-config.xml

And my files are:
createProject.jsp:
=================

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<html:html>
<head>
<title>Hi</title>
</head>

<body>

<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr><td> </td>
</tr>
<tr bgcolor="#36566E">
<td height="68" width="48%">
<div align="left">
<img src ="images/logo.gif" width="200" height="74">
</div></td>
</tr>
<tr>
<td></td>
</tr>
</table>
<html:form action="/createProjectAction" >

<table width="45%" border="0">
<tr>

<td>ProjectName:</td>
<td><html:text name="createProjectBean" property="ProjectName" /></td>
</tr>

<tr>
<td>Periodicity<!--<bean:message key="app.period" bundle="ApplicationResources"/>-->:</td>
<td><html:radio name="createProjectBean" property="Periodicity" value="Monthly"/>Monthly</td>
<td><html:radio name="createProjectBean" property="Periodicity" value="Quarterly"/>Quarterly</td>
<td><html:radio name="createProjectBean" property="Periodicity" value="Quarterly"/>Quarterly</td>
</tr>


<tr>
<td>Description<!--<bean:message key="app.desc" bundle="ApplicationResources" />-->:</td>
<td><html:text name="createProjectBean" property="Description" /></td>
</tr>
<tr>
<td><html:button property="submit" value="Submit" /></td>
</tr>

</table>
</html:form>

<!-- Begin Validator Javascript Function -->
<html:javascript formName="projectBean"/>
<!-- End of Validator Javascript Function -->

</body>
</html:html>
2.CreateProjectBean.java:
==========================
package actionClasses;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import formBeans.CreateProjectBean;


public class CreateProjectAction extends Action
{

public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request,
HttpServletResponse response)throws Exception
{
System.out.println("Entered in Action class");
String name,period,desc;

try{
CreateProjectBean bean=(CreateProjectBean)form;
period = bean.getperiodicity();
name = bean.getprojectName();
desc = bean.getdescription();

if(period.equals("")||name.equals("")||desc.equals(""))
{
return mapping.findForward("failure");
}
else
{
request.setAttribute("ProjectName",name);
request.setAttribute("Periodicity",period);
request.setAttribute("Description",desc);

}

}catch(Exception e)
{
System.out.println(e);
}
return mapping.findForward("success");

}

}
3.CreateProjectBean.java:
=========================
package formBeans;

import org.apache.struts.validator.ValidatorForm;
public class CreateProjectBean extends ValidatorForm
{
/**
*
*/
private static final long serialVersionUID = 1L;
String projectName;
String description;
String periodicity;
public String getprojectName() {
return projectName;
}
public void setprojectName(String projectName)
{
this.projectName = projectName;
}
public String getdescription()
{
return description;
}
public void setdescription(String description)
{
this.description = description;
}
public String getperiodicity()
{
return periodicity;
}
public void setperiodicity(String periodicity)
{
this.periodicity = periodicity;
}

}
4.struts-config.xml:
====================
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">

<!--
This is a blank Struts configuration file with an example
welcome action/page and other commented sample elements.

Tiles and the Struts Validator are configured using the factory defaults
and are ready-to-use.

NOTE: If you have a generator tool to create the corresponding Java classes
for you, you could include the details in the "form-bean" declarations.
Otherwise, you would only define the "form-bean" element itself, with the
corresponding "name" and "type" attributes, as shown here.
-->

<struts-config>
<!-- ================================================ Form Bean Definitions
-->
<form-beans type="org.apache.struts.validator.ValidatorForm">
<form-bean name="createProjectBean"
type="formbeans.CreateProjectBean" />
</form-beans>
<!-- =========================================== Action Mapping Definitions
-->
<action-mappings>

<action path="/createProjectAction"
name="createProjectBean"
type="actionClasses.CreateProjectAction"
input="/jsps/createProject.jsp"
validate="true"
scope="request">
<forward name="success" path="/jsps/success.jsp" />
<forward name="failure" path="/jsps/failure.jsp" />
</action>
</action-mappings>

<!-- Entry for MessageResource.Properties -->

<!-- <message-resources parameter="resouceProperties.ApplicationResources" /> -->

<!-- Validator plugin -->


<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" />
</plug-in>

</struts-config>
5.web.xml:
==========
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
<display-name>Struts Blank Application</display-name>

<!-- 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>applicationResources</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</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>


<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>jsps/createProject.jsp</welcome-file>
</welcome-file-list>


<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-nested</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>

</web-app>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65128
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to post Struts questions in the Struts forum. I have moved this post there for you.

Also, please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along. Please read this for more information.

You can go back and change your post to add code tags by clicking the .
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer to this question is found in our FAQ. See question 13.
 
swapna arava
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i thank you
 
swapna arava
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my strtus application i have applied validator frame work.But the thing is " it is reflecting the form in the sense form is not going to next page uunless i enter all fields data." it is validating the form with out displaying any alert messages like in java script.
 
satya ganesh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For any body who is reading this page, this might help...

I faced the same problem only for the first time i start the application, it was tricky and i found that in the web.xml, i did not load the ActionServlet during the start-up and it had not parsed the struts-config.xml when the request had come. The problem is solved when i added the following line in web.xml ActionServlet's configuration,
<load-on-startup>1</load-on-startup>
 
Lynn Hollerman
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, for anyone reading this, I just ran into this error. I get some applications from other developers and upload them to a server, and this error came up after I had just put an update on - it was a mix of .jsps, .xml files, and .class files. Before I got this error, I got another error I was more familiar with - I have seen this earlier error before, when I was initially trying to figure out Java and saw that it meant that the file I was using was compiled with a later version of the JDK than the server had. The main difference between the production and development servers for me is that production uses JDK 1.5, whereas development uses 1.6.

I initially checked the FAQ here to see if that could help - that said there was either a problem with web.xml or struts-config.xml, but there weren't any code changes to either - just some white space had been removed. But one of the things the FAQ said was that the error could mean that I was trying to execute a .jsp before the Action servlet was initialized, and I *did* see an error message about a problem with load() in one of the logs - but there wasn't any reference to a line in the .xml file as the FAQ said there would be.

It turned out that all the .class files had been compiled with 1.6. First I backed out all the files, and then put the new .jsps and .xml files back in - there was no error. Then, I put the recompiled .class files on and restarted the server. The error was still gone. So, it looks to me as the solution was to recompile the .class files with 1.5 and use those. I thought it was a bit odd that the error message didn't say anything about this, but I don't use Struts in my own programming, so for all I know, this could be well-known error...

I hope this helps someone!

Lynn.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic