Unable to instantiate Action, xxxAction, defined for ‘xxx’ in namespace ‘/’xxxAction
2016-09-18 22:56
309 查看
在做项目的时候遇到了一个问题,Unable to instantiate Action, xxxAction, defined for ‘xxx’ innamespace ‘/’xxxAction
在控制台输出的日志中看到了问题,上网查后,在看看我的项目,才明白我将类的包名写错了,导致类实例化时找不到类。
一般出现这样的问题有两种情况。 包名写错,就无法在spring中来管理了,所以就出现这样
1、如果项目没有使用Spring,则struts.xml配置文件中,这个action的class属性的路径没有写完整,应该是包名.类名
2、如果项目使用了Spring,那就是applicationContext.xml里面没有为这个action定义bean。这样strus.xml中的对应action的class属性的值就是Spring配置文件中bean的id,比如:
applicationContext.xml
struts.xml
在控制台输出的日志中看到了问题,上网查后,在看看我的项目,才明白我将类的包名写错了,导致类实例化时找不到类。
一般出现这样的问题有两种情况。 包名写错,就无法在spring中来管理了,所以就出现这样
1、如果项目没有使用Spring,则struts.xml配置文件中,这个action的class属性的路径没有写完整,应该是包名.类名
2、如果项目使用了Spring,那就是applicationContext.xml里面没有为这个action定义bean。这样strus.xml中的对应action的class属性的值就是Spring配置文件中bean的id,比如:
applicationContext.xml
<span style="font-size:18px;"><bean id="adminAction" class="go.derek.action.AdminAction" scope="prototype"> </bean></span>
struts.xml
<span style="font-size:18px;"><action name="admin" class="adminAction" method="execute"> <result>/admin.jsp</result> </action></span>
相关文章推荐
- Unable to instantiate Action, xxxAction, defined for ‘xxx’ in namespace ‘/’xxxAction解决方案
- Unable to instantiate Action, xxxAction, defined for 'xxx' in namespace '/'xxxAction解决方式
- Unable to instantiate Action, xxxAction, defined for ‘xxx’ in namespace ‘/’xxxAction
- Unable to instantiate Action,xxx-action, defined for 'xxx' in namespace '/xxx/xxxx/xxxxx'Error crea
- Unable to instantiate Action, xxxAction, defined for 'xxx' in namespace '/'xxxAction解决方案
- Unable to instantiate Action, xxxAction, defined for 'xxx' in namespace '/'xxxAction解决方案
- Unable to instantiate Action, XXXAction, defined for 'xx' in namespace 'xx'报错解决
- HTTP Status 500 - Unable to instantiate Action, customerAction, defined for 'CustomerAction_list' in
- Unable to instantiate Action,,,,,,,,,defined for ',,,' in namespace '/,,,'null
- Unable to instantiate Action,,,,,,,,,defined for ',,,' in namespace '/,,,'null
- Unable to instantiate Action, Action, defined for 解决方法
- 八、Unable to instantiate Action, xxx.action.DeleteAction, defined for 'delete' in namespace
- Unable to instantiate Action, loginAction, defined for 'login' in namespace
- SSH开发 报错:Unable to instantiate Action, controller.MsgController, defined for'show' in namespace '
- ssh报 HTTP Status 500 - Unable to instantiate Action, com.web.action.UserAction, defined for 'login'
- Unable to instantiate Action, departmentAction, defined for 'department_list' in namespace '/'depart
- HTTP Status 500 - Unable to instantiate Action, AccountAction, defined for 'accountindex' in namespa
- Unable to instantiate Action, defined for t' in namespace '/'XXXAction
- spring-error-1 Unable to instantiate Action, com.fxb.sms.web.action.AdminAction, defined for 'Adm
- Unable to instantiate Action