这一个异常相信会有同志跟我一样遇到过,往往,浏览器里还会出现一段话:
The server encountered an internal error (No action instance for path /user could be created) that prevented it from fulfilling this request
意味着客户端的请求根本发不到服务器,因为,请求路径不能创建(注意,以这样的方式去理解上面一段话会比较合理一点)。
而tomcat这边却什么事都没有,一点提示信息都不给。这就搞得我一肚子肝火!瞪直了眼睛四处找异常,从struts-config.xml到web.xml,
找了半天得出结论是自己的配置没有问题。然后不管是我baidu,还是Google,发现没有一个人给出合理的解释。都一个劲的认为是上面两个
配置文件的问题,要么就说action的package出问题。仔细一看,发现往往解决方案都是出自一个人的手里,只不过呆在不同人的blog而已,真
的是一塌糊涂。
还是决定,自已的问题自己解决,不久在自己的调式过程中就发现,每次我试图在继承Action的子类的构造函数实例化某个成员的时候,上面
鬼怪的异常就出现了,当我toggle comment实例化语句,这一个问题就没有了。原来问题出在这里,为了证实自己的想法,立马翻了一下struts
的api,查Action,发现这么一段话
Actions must be programmed in a thread-safe manner, because the controller will share the same instance for multiple simultaneous requests. This means you should design with the following items in mind:
Instance and static variables MUST NOT be used to store information related to the state of a particular request. They MAY be used to share global resources across requests for the same action.
Access to other resources (JavaBeans, session variables, etc.) MUST be synchronized if those resources require protection. (Generally, however, resource classes should be designed to provide their own protection where necessary.
原来一开始自己就没有遵循Action类继承的原则,即要以线程安全的编程方式去编码。也就是说,Action作为一个全局唯一的控制Servlet,所有的实例对象只能在Action自身有一个唯一的副本,能够同时让多个请求共享同一个实例,而不能为某一个特别的请求实例化成员。
[/size][size=x-small][color=blue][/color]
分享到:
相关推荐
前几天在网上下载一个struts2的helloword的例子,那个作者也真够缺德的,搞个错误的程序,害得我查了一天的程序错误。 最后发现竟然是struts.xml被写成啦sturts.xml。 碰见这样的问题先鄙视下提供例子的作者, ...
本文将深入探讨一种常见的500错误——"No action instance for path /Logon could be created",并提供相应的解决策略。 首先,我们要理解这个错误的根本原因。"No action instance for path /Logon could be ...
3. **No action instance for path /xxxx could be created** 这个异常表示无法为给定路径创建Action实例。可能的原因包括: - Action类的`.class`文件不在正确的类路径下,确保编译后的Action类位于`WEB-INF/...
3. **No action instance for path /xxxx could be created** 这个错误表明Struts无法实例化在`struts-config.xml`中配置的action。可能的原因包括: - 编译后的`.class`文件不在正确的类路径下,通常应位于`WEB-...
3. **No action instance for path /xxxx could be created 异常** 这个错误意味着Struts无法实例化`struts-config.xml`中配置的Action类。这可能是由于以下原因: - 类路径问题:确保Action类的`.class`文件位于`...
第三个异常:“No action instance for path /xxxx could be created”。这个异常意味着Struts无法创建指定路径的Action实例。这可能是因为在struts-config.xml中指定了的Action类在运行时没有被找到。问题可能出在...
3. 异常 No action instance for path /xxxx could be created 这个错误意味着无法创建Action实例。首先,确保Action类已正确编译并位于正确的类路径下,如WEB-INF/classes目录。其次,确认Action类继承自org....
3. 异常`No action instance for path /xxxx could be created` 这个错误可能是因为多种原因,包括找不到编译后的`.class`文件、类路径问题、类名拼写错误或未继承自Struts的`Action`类。确保你的action类位于`WEB-...
在Web开发中,尤其是使用基于Java的Web框架如Struts时,开发者可能会遇到一个常见的问题:“HTTP Status 404 - There is no Action mapped for namespace and action name BackMemberGroupAudit”。这个问题通常出现...
#### 三、异常 No action instance for path /xxxx could be created **异常描述**: 此异常意味着在创建指定路径的Action实例时遇到问题。 **可能原因**: 1. **Class文件未放置在类路径中**:编译后的`.class`...
No action instance for path /xxxx could be created 该异常表明Struts框架无法创建对应路径的Action实例。这可能是因为Action类不存在,或者编译后的`.class`文件没有被正确放置在Web应用的`WEB-INF/classes`...
### Struts2框架中“No result defined for action and result input”错误解析及解决方法 #### 错误概述 在Struts2框架中开发Web应用程序时,可能会遇到一个名为“No result defined for action and result input...
在IT领域,尤其是在Web开发中,遇到“No result defined for action”这类错误是常见的问题,尤其当使用Struts2框架时更为突出。此类错误通常指向在控制器(Action)中未正确配置或实现结果集(Result),导致请求...
3. **异常 No action instance for path /xxxx could be created** 这个错误可能由多种原因引起,如找不到编译后的`.class`文件、包名或类名拼写错误、未继承自Struts `Action`类、classpath问题等。确保action类...
<action path="/anotherAction" type="somePackage.someOtherActionClass"> name="someForm" input="someOtherJSP.jsp" <forward name="successful" path="someResultJSP.jsp"/> </action> ``` 这种配置展示...
标题 "ActionForward" 提到的是 Struts 框架中的一个重要概念,它是 Struts MVC(模型-视图-控制器)架构中的一个关键组件。在 Struts 中,`ActionForward` 负责定义请求处理后的定向路径,它告诉控制器如何将用户...
当我们遇到“Spring MVC No Session found for current thread”的错误时,这通常意味着在尝试访问HttpSession对象时,当前线程没有找到相关的session。这个问题可能是由于多种原因导致的,包括配置错误、过滤器设置...
`action-mappings`元素可以包含零个或多个`<action/>`子元素,每个`<action/>`元素定义了一个特定的操作路径和处理该操作的Action类。 ##### `<action/>`元素详解 - **path**:指定请求URL中的路径部分,该路径是...
<p><form action="()%>/CheckServlet" method="post"> <td height="20" colspan="2"><span class="style1">登陆</span></td> </tr> 用户名</td> <td width="161" align="left"><input name="uname" type="text...
* Object Browser double-click action and drag & drop action could not be defined for database link type * Subprogram declaration popup could be truncated if it included comments * Dates * Selecting...