分享
 
 
 

Struts常见错误及原因分析

王朝other·作者佚名  2008-05-19
窄屏简体版  字體: |||超大  

This page contains errors and exceptions commonly encountered during web application development using Struts. Along with the exception or error messages themselves, potential causes of these errors are often listed along with links to additional resources.

To find the error you're looking for, use your browser's Find or Search capability and input a few words that you are seeing in your error message.

Cannot retrieve mapping for action

错误信息 javax.servlet.jsp.JspException: Cannot retrieve mapping for action /Login

可能原因

lNo action defined in struts-config.xml to match that specified in the JSP's

相关链接

No action instance for path /xxxx could be created

错误信息 No action instance for path /xxxx could be created

可能原因

lSpecial Note: Because so many different things can cause this error, it is recommended that you turn your error logging/debugging levels on your web server to a high level of verbosity to see the underlying problems in trying to instantiate the action class you have written and associated with the specified action xxxx through an action mapping in the struts-config.xml file.

lYour Action class specified in the struts-config.xml file under the class attribute of the action mapping for action xxxx cannot be found for a variety of reasons, including (but not limited to): ?Failure to place compiled .class file for the action in the classpath (needs to be under WEB-INF/classes with the appropriate directory structure underneath this that matches the package your Action class belongs to). ?Package spelling or hierarchy specified in your action class itself (using the package keyword) does not match the spelling or complete package hierachy specified for your action class in the class attribute of the action in struts-config.xml.

lAction class specified in the /xxxx action mapping in the struts-config.xml file (class attribute) does not extend (directly or indirectly) from the Action class. In other words, your custom Action class does not extend off the Struts-provided Action class or off of another class that eventually extends the Action class (such as DispatchAction.

lProblem in your classpath, such as web server not being able to find ApplicationResources.properties files in the WEB-INF/classes/ directory or specified subdirectory.

lProblem in struts-config.xml file with action mapping.

lProblem with data-sources.xml file.

相关链接

lApplication's Action classes does not extend Struts-provided Action class?

lPackage hierarchy/directory structure specified in struts-config.xml file differs from that hierarchy specified in the actual action class's file using the package keyword.http://www.mail-archive.com/struts-user@jakarta.apache.org/msg65874.html ?

lAction Mapping mistake in struts-config.xml:http://www.manning.com/ao/readforum.html?forum=siaao&readthread=177 ?data-sources.xml file?:http://www.caucho.com/quercus/faq/section.xtp?section_id=30

No getter method for property XXXX of bean org.apache.struts.taglib.html.BEAN

错误信息 javax.servlet.jsp.JspException: No getter method for property username of bean org.apache.struts.taglib.html.BEAN

可能原因

lNo getXXXX() method defined for form field with name XXXX

lThis can happen if the JSP/Struts developer forgets that the name of the get method will have the same spelling as the value supplied in the Struts tag's property attribute, but that case will be different and is based on JavaBean specification rules. For example, my form class should have a getUsername method if my Struts form-related tag has username as the value for its property attribute. Note the difference in case marked with emphasis on the letter "U."

相关链接

lCase can trip up the matching between get method's name and name specified in Struts taghttp://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=58&t=000163

Exception creating bean of class org.apache.struts.action.Actionform: {1}

错误信息 javax.servlet.jsp.JspException: Exception creating bean of class org.apache.struts.action.Actionform: {1}

可能原因

lInstantiating Struts-provided Actionform class directly instead of instantiating a class derived off Actionform. This might occur implicitly if you specify that a form-bean is this Struts Actionform class rather than specifying a child of this class for the form-bean.

lNot associating an Actionform-descended class with an action can also lead to this error.

Cannot find ActionMappings or ActionformBeans collection

错误信息 javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionformBeans collection

可能原因

lEither the tags for the Struts action servlet or the tags for the .do extension mapping or both not present in the web.xml file. I saw a case where the web.xml file had no elements other than the root element and so this error was occurring.

lTypos or spelling errors in the struts-config.xml can lead to this error message. For example, missing a slash ("/") on a closing tag can have this effect.

lAnother element that must be present in the web.xml file is the load-on-startup element. This can be either an empty tag or can have an integer specified that indicates the priority of executing the associated servlet. The higher the number in the load-on-startup tags, the lower its priority.

相关链接

NullPointerException at ... RequestUtils.forwardURL

错误信息 java.lang.NullPointerException at org.apache.struts.util.RequestUtils.forwardURL (RequestUtils.java:1223)

可能原因

lMissing path attribute in the forward subelement of the action element in struts-config.xml

相关链接

Cannot find bean org.apache.struts.taglib.html.BEAN in any scope

错误信息 javax.servlet.jsp.JspException: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope

可能原因

lTrying to use Struts form subelement tags outside of the Struts' form tag.

相关链接

lUsing form subelements outside of a form tag http://forum.java.sun.com/thread.jsp?thread=337537&forum=4&message=1384153

Missing message for key xx.xx.xx

错误信息 javax.servlet.jsp.JspException: Missing message for key xx.xx.xx

可能原因

lThe key-value pair with specified key is not in ApplicationResources.properties file

lApplicationResources.properties file not in classpath (not in WEB-INF/classes directory in specified location)

相关链接

Cannot find message resources under key org.apache.struts.action.MESSAGE

错误信息 Cannot find message resources under key org.apache.struts.action.MESSAGE

可能原因

lExplicitly trying to use message resources that are not available (such as ApplicationResources.properties not available

lImplicitly trying to use message resources that are not available (such as using empty html:options tag instead of specifying the options in its body -- this assumes options are specified in ApplicationResources.properties file)

lXML parser issues -- too many, too few, incorrect/incompatible versions

相关链接

lXML Parser Issues http://www.mail-archive.com/struts-user@jakarta.apache.org/msg15779.html

No input attribute for mapping path /loginAction

错误信息 No input attribute for mapping path /xxxxAction

可能原因

lNo input attribute in action mapping in struts-config.xml file for the action with the name specified in the error message. An input attribute is not required if form validation is not performed (either because the validate attribute is set to false or because the validation method in the relevant form class is not implemented. The input attribute specifies the

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有