FAQ-junit报错:class path resource
来源:互联网 发布:环境大数据研究中心 编辑:程序博客网 时间:2024/06/06 17:26
问题:
项目引入junit单元测试时,报错如下:
java.io.FileNotFoundException: class path resource [WEB-INF/content/global/] cannot be resolved to URL because it does not exist at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:163) at org.springframework.core.io.ClassPathResource.getFile(ClassPathResource.java:175) at org.springframework.mock.web.MockServletContext.getResourcePaths(MockServletContext.java:196) at org.apache.struts2.convention.DefaultResultMapBuilder.createFromResources(DefaultResultMapBuilder.java:254) at org.apache.struts2.convention.DefaultResultMapBuilder.build(DefaultResultMapBuilder.java:191) at org.apache.struts2.convention.PackageBasedActionConfigBuilder.createActionConfig(PackageBasedActionConfigBuilder.java:864) at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildConfiguration(PackageBasedActionConfigBuilder.java:636) at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:335) at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
解决方法:
struts2-convention-plugin-2.3.1.2.jar插件,默认路径为WEB-INF/content/(可以配置: <constant name="struts.convention.result.path" value="/WEB-INF/content" />
),
按照该插件的映射规则[对于以Action结尾的的类,往掉Action,取剩下的部分,将所有的字母转换为小写,假如有驼峰式的写法,则用”-“连接符来连接不同的单词,这是此插件的默认方式。]说明global可能是GlobalAction,然后项目中找到该action,干掉即可。
参考:
- Struts2-convention-plugin全注解在开发中的应用(原创类)
- StrutsSpringTestCase使用时的错误
- struts2采用convention-plugin实现零配置
0 0
- FAQ-junit报错:class path resource
- PAFA 框架报错java.io.FileNotFoundException: class path resource [log4j.properties] cannot be resolved to
- Spring 整合Hibernate报错:Error creating bean with name 'dataSource' defined in class path resource
- spring报错:Unexpected exception parsing XML document from class path resource [Beans_annotation.xml]
- spring boot启动报错Error creating bean with name 'entityManagerFactory' defined in class path resource [
- FAQ(19):java.io.FileNotFoundException: class path resource [resources/applicationContext.xml] cannot
- [SSM/Junit]java.io.FileNotFoundException: class path resource [spring-mybatis.xml] cannot be opened
- StrutsSpringTestCase中使用convention报Couldn't get resource paths for class path resource的解决方案
- FAQ-junit报错:javax/servlet/jsp/PageContext
- junit测试报错:class not found
- mybatis与spring整合报错Error creating bean with name 'sqlSessionFactory' defined in class path resource
- eclipse下项目报错class path resource [com/xzhang/mapping/] cannot be resolved to URL because it does not
- eclipse项目报错怎么解决class path resource [beans.xml] cannot be opened because it does not exist
- junit测试时找不到资源路径java.io.FileNotFoundException: class path resource [config/EBSConfig.xml] cannot be o
- RESTEASY报错Could not find resource for full path
- JUnit FAQ.
- FAQ(5):conf文件夹的mybatis-config.xml找不到,报错Could not find resource config/myBatis-config.xml
- junit 报错
- 基础总结篇之三:Activity的task相关
- 写给 Node.js 学徒的 7 个建议
- liger UI tree DATA添加值
- android-Camera.Face
- 学习设计模式前言
- FAQ-junit报错:class path resource
- MyBatis学习总结(六)——调用存储过程
- UITableview顶部视图缩放效果
- HTML属性
- 陀螺仪控制物体
- 【NOIP2013模拟联考5】军训
- 京城游戏人-Day2:一些 C# 与 Unity 基本常识
- MyBatis学习总结(七)——Mybatis缓存
- Android Studio SDK Manager 解决无法更新问题