aspose file tools*
The moose likes Struts and the fly likes DynaActionForm - Exception creating bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "DynaActionForm - Exception creating bean " Watch "DynaActionForm - Exception creating bean " New topic
Author

DynaActionForm - Exception creating bean

kirty nahar
Greenhorn

Joined: May 02, 2002
Posts: 11
I'm trying to work with DynaActionForm. When I try to access my page it gives me following exception

Exception creating bean of class selectica.DynamicLookupForm: {1}

Can you kindly let me know what could be the possible problem.

My struts-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-beans>
<form-bean name="LookupFormBean" type="selectica.LookupForm"/>

<form-bean name="dynamicLookupForm" type="selectica.DynamicLookupForm">
<form-property name="symbol" type="java.lang.String" initial="MSFT"/>
</form-bean>

</form-beans>


<action-mappings>
<action path="/Lookup" type="selectica.LookupAction" name="LookupFormBean">
<forward name="success" path="/quote.jsp"/>
<forward name="failure" path="/index.jsp"/>
</action>
</action-mappings>

<action-mappings>
<action path="/DynamicLookup" type="selectica.DynamicLookupAction" name="dynamicLookupForm">
<forward name="success" path="/quote.jsp"/>
<forward name="failure" path="/index.jsp"/>
</action>
</action-mappings>
</struts-config>



My dynamicindex.jsp

<%@ page language="java"%>
<%@ taglib uri = "/WEB-INF/struts-html.tld" prefix="html"%>
<html>
<head>
<title>Wrox struts Application</title>
</head>

<body>tertwr
<table width="500" border="0" cellspacing="0" cellpadding="0">
hello.....
<tr>
<td> </td>
</tr>

<tr>
<td height="68" width="48%">
<div align="left">
<img src="images/new.gif">
</div>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>

<html:form action="/DynamicLookup">
Symbol: <html:text property="symbol"/>
<html:submit/>
</html:form>

</body>
</html>



My DynamicLookupAction

package selectica;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class DynamicLookupAction extends Action
{
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
{
String target=new String("failure");
Double price=null;

if(form !=null)
{
DynaActionForm lform=(DynaActionForm)form;
String symbol=(String)lform.get("symbol");
if(symbol.equals("Selectica"))
{
price = new Double(25.00);
request.setAttribute("PRICE",price);
target="success";

}
}

return mapping.findForward(target);

}
}


The error occurs when I try to access dynamicindex.jsp

Thanks in Advance
Kirty
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Full stack trace of exception, please.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
kirty nahar
Greenhorn

Joined: May 02, 2002
Posts: 11
Here it is :


org.apache.jasper.JasperException: Exception creating bean of class selectica.DynamicLookupForm: {1}
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)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:479)


root cause

javax.servlet.ServletException: Exception creating bean of class selectica.DynamicLookupForm: {1}
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
at org.apache.jsp.dynamicindex_jsp._jspService(dynamicindex_jsp.java:91)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:479)
Rao Sunkara
Greenhorn

Joined: May 21, 2005
Posts: 1
duplicate of giving the form name in the struts-config filr i.e. that particular actionForm was already used in other action
Pia Pringle
Greenhorn

Joined: Jun 05, 2006
Posts: 21
So if the Form Bean was used before it can't be accessed again ? Suppose you want to access a value stored in it ?
Kurt Boets
Greenhorn

Joined: Oct 19, 2004
Posts: 14
A little late but still.
I had the same problem, and it took me a while to find the solution.
I added the commons-validator 1.3.0 to my web-inf.
After that, everything worked correctly.
Dom Lassy
Ranch Hand

Joined: May 05, 2006
Posts: 181
Originally posted by Rao Sunkara:
duplicate of giving the form name in the struts-config filr i.e. that particular actionForm was already used in other action


This is not true.

Anyway, you're declaring the form incorrectly.

[ October 26, 2007: Message edited by: Dom Lassy ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DynaActionForm - Exception creating bean