`
king_tt
  • 浏览: 2222146 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

spring、struts、mybatis集成WARN [com.opensymphony.xwork2.util.FileManager] (MSC service thread 1-1) Cou

 
阅读更多

本人在进行spring、struts、mybatis集成过程中出现了很多问题,现记录如下,希望对本人以后及其它遇到类似错误的人提供一些借鉴。

1、Eclipse使用问题
当选择server(如JBoss)的发布按钮没有反应或者没有变化时,此时应在server上点击右键,然后选择“clean”,此时项目会进行清理和发布。

2、版本问题
Struts、 Spring、Mybatis版本要匹配,否则会出现莫名奇妙的警告,例如本人开始使用的版本是:struts-2.2.3、spring3.1、 mybatis-3.1.1,出现下面的警告,当将struts的版本换成struts-2.3.7时,警告消失。
WARN [com.opensymphony.xwork2.util.FileManager] (MSC service thread 1-1) Could not create JarEntryRevision for [vfs:/D:/JBoss/jbossAS711Final/standalone/deployments/SS2MTest.war/WEB-INF/lib/struts2-spring-plugin-2.2.3]!: java.io.FileNotFoundException: vfs:/D:/JBoss/jbossAS711Final/standalone/deployments/SS2MTest.war/WEB-INF/lib/struts2-spring-plugin-2.2.3 (文件名、目录名或卷标语法不正确。)
at java.util.zip.ZipFile.open(Native Method) [rt.jar:1.6.0_07]
at java.util.zip.ZipFile.<init>(ZipFile.java:114) [rt.jar:1.6.0_07]
at java.util.jar.JarFile.<init>(JarFile.java:133) [rt.jar:1.6.0_07]
at java.util.jar.JarFile.<init>(JarFile.java:97) [rt.jar:1.6.0_07]
at com.opensymphony.xwork2.util.FileManager$JarEntryRevision.build(FileManager.java:307) [xwork-core-2.2.3.jar:2.2.3]
at com.opensymphony.xwork2.util.FileManager.loadFile(FileManager.java:145) [xwork-core-2.2.3.jar:2.2.3]
at com.opensymphony.xwork2.util.FileManager.loadFile(FileManager.java:105) [xwork-core-2.2.3.jar:2.2.3]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:898) [xwork-core-2.2.3.jar:2.2.3]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:154) [xwork-core-2.2.3.jar:2.2.3]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:121) [xwork-core-2.2.3.jar:2.2.3]
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:179) [xwork-core-2.2.3.jar:2.2.3]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66) [xwork-core-2.2.3.jar:2.2.3]
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:380) [struts2-core-2.2.3.jar:2.2.3]
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424) [struts2-core-2.2.3.jar:2.2.3]
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69) [struts2-core-2.2.3.jar:2.2.3]
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51) [struts2-core-2.2.3.jar:2.2.3]
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:447) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3269) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3865) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [rt.jar:1.6.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [rt.jar:1.6.0_07]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]

3、Struts错误
ERROR [org.apache.struts2.dispatcher.Dispatcher] (MSC service thread 1-1) Dispatcher initialization failed: Unable to load configuration. - [unknown location]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:71) [xwork-core-2.3.7.jar:2.3.7]
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:429) [struts2-core-2.3.7.jar:2.3.7]
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:471) [struts2-core-2.3.7.jar:2.3.7]
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74) [struts2-core-2.3.7.jar:2.3.7]
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51) [struts2-core-2.3.7.jar:2.3.7]
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:447) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3269) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3865) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [rt.jar:1.6.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [rt.jar:1.6.0_07]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]
Caused by: Cannot locate the chosen ObjectFactory implementation: spring - [unknown location]
at org.apache.struts2.config.BeanSelectionProvider.alias(BeanSelectionProvider.java:391) [struts2-core-2.3.7.jar:2.3.7]
at org.apache.struts2.config.BeanSelectionProvider.alias(BeanSelectionProvider.java:362) [struts2-core-2.3.7.jar:2.3.7]
at org.apache.struts2.config.BeanSelectionProvider.register(BeanSelectionProvider.java:288) [struts2-core-2.3.7.jar:2.3.7]
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:215) [xwork-core-2.3.7.jar:2.3.7]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:68) [xwork-core-2.3.7.jar:2.3.7]
... 13 more

解决方法:
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>configFiles/struts.xml</param-value>
</init-param>
</filter>

改成

<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>platform-web.xml,struts-default.xml,struts-plugin.xml,configFiles/struts.xml</param-value>
</init-param>
</filter>

4、Spring错误
ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-3) Context initialization failed:
org.springframework.beans.factory.BeanDefinitionStoreException: Could not resolve bean definition resource pattern [configFiles/applicationContext*.xml]; nested exception is java.io.FileNotFoundException: ServletContext resource [/configFiles/] cannot be resolved to URL because it does not exist
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:190) [spring-beans-2.5.6.jar:2.5.6]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) [spring-beans-2.5.6.jar:2.5.6]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) [spring-web-2.5.6.jar:2.5.6]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92) [spring-web-2.5.6.jar:2.5.6]
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123) [spring-context-2.5.6.jar:2.5.6]
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422) [spring-context-2.5.6.jar:2.5.6]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) [spring-context-2.5.6.jar:2.5.6]
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) [spring-web-2.5.6.jar:2.5.6]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) [spring-web-2.5.6.jar:2.5.6]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) [spring-web-2.5.6.jar:2.5.6]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [rt.jar:1.6.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [rt.jar:1.6.0_07]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]
Caused by: java.io.FileNotFoundException: ServletContext resource [/configFiles/] cannot be resolved to URL because it does not exist
at org.springframework.web.context.support.ServletContextResource.getURL(ServletContextResource.java:130) [spring-web-2.5.6.jar:2.5.6]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.isJarResource(PathMatchingResourcePatternResolver.java:406) [spring-core-

2.5.6.jar:2.5.6]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:338) [spring-core-2.5.6.jar:2.5.6]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:276) [spring-core-2.5.6.jar:2.5.6]
at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1018) [spring-context-2.5.6.jar:2.5.6]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:177) [spring-beans-2.5.6.jar:2.5.6]
... 17 more

解决方法:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>configFiles/applicationContext*.xml</param-value>
</context-param>

改成
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:configFiles/applicationContext*.xml</param-value>
</context-param>
注意:与spring相关的配置文件路径,都要使用classpath*:或其它关键字来限定位置,这与struts不一样。

分享到:
评论

相关推荐

    mybatis-spring-1.3.1.jar下载

    MyBatis-Spring 1.3.1 是一个重要的Java库,它为MyBatis持久层框架和Spring框架提供了一座桥梁,使得两个强大的库能够无缝集成。这个版本的jar文件是开发者在使用MyBatis与Spring进行项目开发时必不可少的组件。下面...

    mybatis-spring-1.3.0.jar 下载

    《深入解析mybatis-spring-1.3.0.jar:集成与应用》 在Java开发领域,MyBatis和Spring框架的结合使用是常见的实践,它们的整合使得数据访问层的构建更为便捷和灵活。本篇文章将围绕"mybatis-spring-1.3.0.jar"这一...

    mybatis-spring-1.3.3.jar官方下载

    MyBatis-Spring 是一个将 MyBatis ORM 框架与 Spring 框架集成的库,使得在 Spring 应用中使用 MyBatis 变得更加方便。mybatis-spring-1.3.3.jar 文件是这个集成库的一个版本,提供了对 MyBatis 1.3.3 和 Spring 的...

    mybatis-3-config.dtd mybatis-3-mapper.dtd

    在MyBatis中,`mybatis-3-config.dtd` 和 `mybatis-3-mapper.dtd` 是两个至关重要的DTD(Document Type Definition)文件,它们定义了MyBatis配置文件和映射文件的结构和规则。 首先,让我们深入了解一下`mybatis-3...

    spring-mybatis-struts2-master ——demo

    《SSM框架整合详解——基于spring-mybatis-struts2-master的实战分析》 在Java Web开发领域,SSM(Spring、Struts2、MyBatis)框架的组合被广泛使用,因其灵活性和强大的功能而备受青睐。本篇文章将深入探讨这个...

    mybatis-spring-boot-starter-2.1.3.jar

    mybatis-spring-boot-starter-2.1.3.jarmybatis-spring-boot-starter-2.1.3.jarmybatis-spring-boot-starter-2.1.3.jar

    mybatis-spring-2.0.6.jar

    mybatis-spring-2.0.6.jar

    mybatis-spring-1.31.jar

    《MyBatis-Spring 1.3.1:构建高效SSM整合的基石》 MyBatis-Spring 1.3.1.jar是MyBatis与Spring框架深度整合的一个重要组件,它允许开发者在Spring环境下无缝地使用MyBatis。这个版本是官方发布的最新稳定版,经过...

    MyBatis整合Spring中间件jar包 mybatis-spring-1.3.0.jar

    MyBatis-Spring是MyBatis与Spring框架的整合组件,其主要目的是简化在Spring应用中集成MyBatis的过程,使两者能够无缝协作。mybatis-spring-1.3.0.jar是这个中间件的特定版本,包含了实现这种集成所需的所有类和资源...

    mybatis-spring-2.0.6-API文档-中文版.zip

    赠送jar包:mybatis-spring-2.0.6.jar; 赠送原API文档:mybatis-spring-2.0.6-javadoc.jar; 赠送源代码:mybatis-spring-2.0.6-sources.jar; 赠送Maven依赖信息文件:mybatis-spring-2.0.6.pom; 包含翻译后的API...

    项目配置文件( spring-mvc.xml spring-mybatis.xml web.xml log4j.properties)

    2. **spring-mybatis.xml**: 这个文件是Spring与MyBatis集成的关键,用于配置数据源、事务管理器、SqlSessionFactory以及Mapper扫描器。通过这个配置,Spring可以管理MyBatis的SqlSession,实现数据库操作的事务控制...

    spring-mybatis-spring-1.3.2.tar.gz

    《SSM框架详解:基于spring-mybatis-spring-1.3.2.tar.gz的实践与探索》 在Java开发领域,SSM框架(Spring、SpringMVC、MyBatis)是广泛使用的三大组件,它们各自负责不同的职责,共同构建出高效、灵活的企业级应用...

    mybatis-spring-boot-starter-3.0.1.jar

    MyBatis Spring Boot Starter.jar 各个版本,免费下载。 MyBatis Spring Boot Starter.jar 起步依赖和自动配置。

    mybatis-spring-2.0.0-API文档-中文版.zip

    赠送jar包:mybatis-spring-2.0.0.jar; 赠送原API文档:mybatis-spring-2.0.0-javadoc.jar; 赠送源代码:mybatis-spring-2.0.0-sources.jar; 赠送Maven依赖信息文件:mybatis-spring-2.0.0.pom; 包含翻译后的API...

    spring-mybatis-lib.rar

    spring与mybatis集成jar包 当前包解决了org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()Ljava/lang/这个报错问题 mybatis-spring-2.0.2.jar mybatis-3.1.1.jar spring-aop-3.2.16.RELEASE....

    mybatis-spring-boot-starter-2.1.4.jar

    mybatis-spring-boot-starter-2.1.4.jarmybatis-spring-boot-starter-2.1.4.jar

    mybatis-spring-1.2.0.jar

    标题 "mybatis-spring-1.2.0.jar" 提供了我们正在讨论的软件组件的核心信息,即MyBatis-Spring的特定版本——1.2.0。MyBatis-Spring是MyBatis和Spring框架集成的一个库,旨在简化在Spring应用中使用MyBatis的工作。...

    mybatis-spring-2.0.3-API文档-中文版.zip

    赠送jar包:mybatis-spring-2.0.3.jar; 赠送原API文档:mybatis-spring-2.0.3-javadoc.jar; 赠送源代码:mybatis-spring-2.0.3-sources.jar; 赠送Maven依赖信息文件:mybatis-spring-2.0.3.pom; 包含翻译后的API...

    spring-mybatis-spring-1.2.0.zip

    MyBatis-Spring是一个连接Spring和MyBatis的轻量级库,它使得两个框架可以无缝集成。它提供了SqlSessionFactoryBean和SqlSessionTemplate等类,帮助我们配置MyBatis并管理SqlSession。 2. 数据源配置:Spring管理...

Global site tag (gtag.js) - Google Analytics