最近写SSH2的项目时,遇到一些小问题,action得不到service实例,遂将struct2委托给spring进行管理,然后修改了bean的id和action的class,但是运行后发现找不到action.

报了这个错误

Unable to instantiate Action, roomtypeAction,  defined for 'roomtypeAction' in namespace '/'roomtypeAction

上网找了好久才发现原来原因是这个:

找不到 applicationContext.xml 中 bean id="xxxxx"

解决办法:

首先确认下 applicationContext.xml 文件存放路径

如果 applicationContext.xml 存入在 src 目录下 , 请在 web.xml 中添加如下配置:

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext*.xml,classpath*:/context/applicationContext*.xml</param-value>
</context-param>

如果 applicationContext.xml 存入在 WEB-INF 目录下,请在web.xml下删掉或注释掉以下配置:

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext*.xml,classpath*:/context/applicationContext*.xml</param-value>
</context-param>

Unable to instantiate Action, xxxAction, defined for 'xxxAction' in namespace '/'xxx的更多相关文章

  1. SSH Spring3\Java1.8 “Unable to instantiate Action, xxAction, defined for 'xxAction_login' in namespace '/'null”

    1.Stacktraces Unable to instantiate Action,xxAction, defined for 'xxAction_login' in namespace '/'nu ...

  2. SSH整合:Unable to instantiate Action, employeeAction, defined for 'emp-list' in namespace '/'employeeAction - action

    SSH整合,照着视频敲的,不知为何会报错,经历了快两周的折磨给解决了.记录下来给后面需要帮助的人,也算极好的了. Struts Problem Report Struts has detected a ...

  3. SSH整合报错:Unable to instantiate Action, testAction, defined for 'test' in namespace '/'testAction

    报错如下: Struts Problem Report Struts has detected an unhandled exception: Messages: testAction Unable ...

  4. 出现"Unable to instantiate Action,xxxxx, defined for 'login' in namespace '/' xxxxx 解决办法

    转自:https://blog.csdn.net/heroful/article/details/17261169 问题原因: 在MyEclipse 利用SSH框架写程序,运行时出现 " U ...

  5. 2.Unable to instantiate Action, templateAction, defined for 'template_list' in namespace '/'templateAction

    1.错误说没有命名空间'templateAction,但是在struts里写了这个,名字跟Action的名字是一样的,为什么会报这个错误 2.反复检查路径和名字,都没有问题 3.发现没有对其进行注入操 ...

  6. Unable to instantiate Action, MenuAction, defined for 'QueryMenuAll' in namespace '/'MenuAction

    我刚好也遇到这样的情况,发现是自己的配置文件里写错了,spring里的id属性值要对应struts里class属性值.

  7. HTTP Status 500 - Unable to instantiate Action, customerAction, defined for 'customer_toAddPage' i

    使用struts2时碰到这样的错误 HTTP Status 500 - Unable to instantiate Action, customerAction, defined for 'custo ...

  8. 报错HTTP Status 500 - Unable to instantiate Action

    报错如下: HTTP Status 500 - Unable to instantiate Action, visitAction, defined for 'visit_toAddPage' in ...

  9. struts2整合spring出现的Unable to instantiate Action异常

    在struts2整合spring的时候,完全一步步按照官方文档上去做的,最后发现出现 Unable to instantiate Action,网上一搜发现很多人和我一样的问题,配置什么都没有错误,就 ...

随机推荐

  1. jvm--深入理解java虚拟机 精华总结(面试)(转)

    深入理解java虚拟机 精华总结(面试)(转) 原文地址:http://www.cnblogs.com/prayers/p/5515245.html 一.运行时数据区域 3 1.1 程序计数器 3 1 ...

  2. Metasploit 简单渗透应用

    1.Metasploit端口扫描: 在终端输入msfconsole或直接从应用选metasploit 进入msf>nmap -v -sV 192.168.126.128  与nmap结果一样 用 ...

  3. 导出Excel(Ext 前台部分)

    开发思路: - 序列化当前GridPanel 数据, 表头结构(用于对应关系), 通过控制器Aspose写到Excel中, 然后返回临时文件地址, 弹出窗口下载. function btnExport ...

  4. Java笔记Spring(二)

    spring-core 通过Gradle构建工具,转换包的命名空间为org.springframework下 cglib包,net.sf.cglib -> org.springframework ...

  5. vi 使用小结

    复制 1,ny 从哪行到哪行的复制,中间用逗号隔开,然后命令y. 黏贴 是在命令模式下直接按p即可 跳到n行: 命令模式直接输入数字即可 剪切:d命令 删除:x命令 跳到行首行尾:直接home或end ...

  6. 实验五:Xen环境下多虚拟机的桥接配置

    实验名称: Xen环境下多虚拟机的桥接配置 实验环境: 这里我们首先需要有一台已经安装好的虚拟机机,能够正常运行,且网卡正常,如下图: 实验需求: 进行虚拟机的复制,并添加新的网桥配置,然后将两台虚拟 ...

  7. leetcode14:最长公共字符串

    编写一个函数来查找字符串数组中的最长公共前缀. 如果不存在公共前缀,返回空字符串 "". 示例 1: 输入: ["flower","flow" ...

  8. Optional 的基本用法

    参考: https://www.cnblogs.com/xingzc/p/5778090.html http://www.runoob.com/java/java8-optional-class.ht ...

  9. 创建Flask实例对象时的参数和app.run()中的参数

    app=Flask(name,static_folder=“static”,static_url_path="/aaa",template_folder=“templates”) ...

  10. VSCode搭建Java开发运行环境

    用了一段时间VSCode,觉得还可以,想用VSCode整合不同的开发语言,于是研究了一下利用VSCode搭建Java环境.开发Java程序.网上这方面的帖子有不少,但每人的经历不同,把自己的经历记下来 ...