• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Cannot retrieve mapping for action

 
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

i am getting a problem while running my struts application, i have one index file in that file i configured my links example

<li><html:link page="/TestAction.do">Test the Action</html:link>
<br>Action class forwards the TestAction.jsp file to the user.
</li>

when i click on this link i am getting this error 404 serletaction is not available and in console i getting this message

javax.servlet.jsp.JspException: Cannot retrieve definition for form bean AddressForm
at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:831)
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
at org.apache.jsp.pages.Address_jsp._jspx_meth_html_form_0(Address_jsp.java:158)
at org.apache.jsp.pages.Address_jsp._jspx_meth_html_html_0(Address_jsp.java:113)
at org.apache.jsp.pages.Address_jsp._jspService(Address_jsp.java:77)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:619)
May 21, 2008 12:53:40 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet action is currently unavailable
May 21, 2008 12:54:14 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet action is currently unavailable
May 21, 2008 12:55:20 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet action is currently unavailable
May 21, 2008 12:55:53 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet action is currently unavailable
May 21, 2008 12:56:08 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet action is currently unavailable
May 21, 2008 1:10:45 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet action is currently unavailable



and this is my struts-config.xml file


<action path="/TestAction"
type="src.rose.net.TestAction"
name="TestAction">

<forward name="testAction"
path="/pages/TestAction.jsp"></forward>
</action>


is there special cenarios to use tlds, i am thinking getting error with this tlds,please correct me.

Regards,
vardhan
[ May 21, 2008: Message edited by: vishnu vardhan ]
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This seems to be the error you encountering "Cannot retrieve definition for form bean AddressForm"

Have you defined a form bean called AddressForm in struts-config.xml?
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you ll need to define something like this in struts-config.xml ..


Try this..
 
Reshma Reddy
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
sagar still i am getting same problem

Here i am pasting my struts-config.xml file Please see this and tell me what exactly my mistake is

<?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>

<!-- ==========Datasource Configuration -->
<data-sources>
</data-sources>

<!-- ==========FromBeans Configuration -->
<form-beans>
<form-bean name="AddressFrom" type="src.rose.net.AddressForm">
</form-bean>
</form-beans>

<!-- ==========Global Exceptions Configuration -->
<global-exceptions>
<!-- this is sample exception
<exception key="" type="" path=""></exception> -->
</global-exceptions>

<!-- ==========GlobalForwards Confoguration -->
<global-forwards>

<!-- for this default forward is welcome.jsp -->
<!-- demonstrates using index.jsp to forward -->
<forward name="welcome"
path="/welcome.do"></forward>

</global-forwards>

<!-- ==========ActionMappings Configuration -->
<action-mappings>
<!-- default mapping is welcome action -->
<!-- forwards to welcome.jsp -->
<action path="/Welcome"
forward="/pages/Welcome.jsp"></action>

<action path="/TestAction"
type="src.rose.net.TestAction"
name="TestAction">

<forward name="testAction"
path="/pages/TestAction.jsp"></forward>
</action>

<action path="/Address"
type="src.rose.net.AddressAction"
name="AddressForm"
validate="true"
input="/pages/Address.jsp"
scope="request">

<forward name="success" path="/pages/success.jsp"></forward>
</action>

<action path="/AddressJavascriptValidation"
name="AddressFrom"
type="src.rose.net.AddressAction"
validate="true"
scope="request"
input="/pages/AddressJavascriptValidation.jsp">

<forward name="success" path="/pages/success.jsp"></forward>
</action>

<action path="/Tiles/Example"
forward="Tiles.Example"></action>

</action-mappings>

<!-- ========Controller Configuration -->
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor">
</controller>

<!-- MessageResource Defination -->
<message-resources parameter="MessageResources">
</message-resources>

<!-- Plugin Configuration -->

<plug-in className="org.apche.struts.tiles.TilesPlugin">
<set-property property="difinations-config" value="/WEB-INF/tiles-defs.xml"></set-property>
<set-property property="moduleAware" value="true"/>
</plug-in>

<plug-in className="org.apache.struts.validator.ValidatorPlugin">
<!-- path to XML files -->
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>

</struts-config>


Regards,
vardhan
[ May 26, 2008: Message edited by: vishnu vardhan ]
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vishnu,

The form-bean definition for TestAction is still missing in you struts-config.xml. ie,
<form-bean name="TestAction" type="src.rose.net.TestActionForm"> is missing.

It would be better if you paste the error message also.

Regards,
Suresh.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you did not define the form in your struts-config.xml
 
Reshma Reddy
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i tried with form entry in struts-config.xml but it is not working getting same error message.

regards,
vardhan
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

javax.servlet.jsp.JspException: Cannot retrieve definition for form bean AddressForm
...
<form-bean name="AddressFrom" type="src.rose.net.AddressForm">
</form-bean>



Have you created the src.rose.net.AddressForm class? How many fields does it have?
[ June 02, 2008: Message edited by: James Clark ]
 
Reshma Reddy
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi james,
In my form 3 fields is there and i am pasting my form class here have a look


package src.rose.net;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class AddressForm extends ActionForm{

private String name=null;
private String address=null;
private String emailaddress=null;

public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getEmailaddress() {
return emailaddress;
}
public void setEmailaddress(String emailaddress) {
this.emailaddress = emailaddress;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}

public void reset(ActionMapping mapping,HttpServletRequest request){

this.name = null;
this.address = null;
this.emailaddress = null;

}
public ActionErrors validate(ActionMapping mapping,HttpServletRequest request){
ActionErrors errors = new ActionErrors();

if(getName()==null ||getName().length()<1){
errors.add("name", new ActionMessage("error.name.required"));
}
if (getAddress()==null || getAddress().length()<1) {
errors.add("address", new ActionMessage("error.address.required"));
}
if (getEmailaddress()==null || getEmailaddress().length()<1) {
errors.add("emailaddress", new ActionMessage("error.emailaddress.required"));
}
return errors;
}

}


Regards,
vardhan
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<action path="/Address"
type="src.rose.net.AddressAction"
name="AddressForm"
validate="true"
input="/pages/Address.jsp"
scope="request">

<form-beans>
<form-bean name="AddressFrom" type="src.rose.net.AddressForm">

Add information about fields here

</form-bean>
</form-beans>

The value of the name attribute of the form-bean element and the value of the name attribute of the action element should be the same.
[ June 04, 2008: Message edited by: James Clark ]
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sir,
When i run the project in struts frame work. following error will be occured. How i am solve this error,any one can help me.

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Cannot retrieve mapping for action /r
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.Input_jsp._jspService(org.apache.jsp.Input_jsp:81)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

javax.servlet.jsp.JspException: Cannot retrieve mapping for action /r
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:759)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:443)
org.apache.jsp.Input_jsp._jspx_meth_html_form_0(org.apache.jsp.Input_jsp:98)
org.apache.jsp.Input_jsp._jspService(org.apache.jsp.Input_jsp:71)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.11 logs.

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Kindly paste the Struts-config.xml file and jsp file here...
 
Ranch Hand
Posts: 50
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey do not use .do in link.
<html:link page="/TestAction.do">

write only <html:link page="/TestAction">
please reply even if it dnt work
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!