2
而在JBoss 7.1 serevr部署的Spring MVC應用程序異常,同時部署JBoss服務器上的Spring MVC應用
請檢查下面
日誌我收到以下錯誤我要整合彈簧的Hibernate JPA也想使用Spring的事務管理
日誌
[org.springframework.web.context.ContextLoader] (MSC service thread 1-5) Context initialization failed: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]; nested exception is java.lang.NoClassDefFoundError: org/jboss/virtual/VirtualFileVisitor
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) [org.springframework.beans- 3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) [org.springframework.beans- 3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) [org.springframework.beans- 3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) [org.springframework.context- 3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:465) [org.springframework.context- 3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:395) [org.springframework.context-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
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.runWorker(Unknown Source) [rt.jar:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_17]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_17]
Caused by: java.lang.NoClassDefFoundError: org/jboss/virtual/VirtualFileVisitor
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingRes ources(PathMatchingResourcePatternResolver.java:348) [org.springframework.core- 3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:269) [org.springframework.core- 3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1196) [org.springframework.context-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:204) [org.springframework.context-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:204) [org.springframework.context-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:84) [org.springframework.context-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanD efinitionParserDelegate.java:1335) [org.springframework.beans- 3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:136) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
... 21 more
Caused by: java.lang.ClassNotFoundException: org.jboss.virtual.VirtualFileVisitor from [Module "deployment.IOCS.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
... 34 more
16:14:07,759 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host]. [/IOCS]] (MSC service thread 1-5) Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]; nested exception is java.lang.NoClassDefFoundError: org/jboss/virtual/VirtualFileVisitor
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) [org.springframework.context-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:465) [org.springframework.context-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:395) [org.springframework.context-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
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.runWorker(Unknown Source) [rt.jar:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_17]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_17]
Caused by: java.lang.NoClassDefFoundError: org/jboss/virtual/VirtualFileVisitor
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingRes ources(PathMatchingResourcePatternResolver.java:348) [org.springframework.core- 3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:269) [org.springframework.core-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1196) [org.springframework.context-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:204) [org.springframework.context-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:204) [org.springframework.context-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentSca nBeanDefinitionParser.java:84) [org.springframework.context- 3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1335) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:136) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) [org.springframework.beans-3.0.1.RELEASE.jar:3.0.1.RELEASE]
... 21 more
Caused by: java.lang.ClassNotFoundException: org.jboss.virtual.VirtualFileVisitor from [Module "deployment.IOCS.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
... 34 more
16:14:07,826 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-5) Error listenerStart
16:14:07,827 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-5) Context [/IOCS] startup failed due to previous errors
16:14:07,839 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/IOCS]] (MSC service thread 1-5) Closing Spring root WebApplicationContext
16:14:07,844 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.web.deployment.default-host./IOCS: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./IOCS: JBAS018040: Failed to start context
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:95)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_17]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_17]
這個我我的配置文件
MVC-調度員servelt.xml
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<context:annotation-config />
<context:component-scan base-package="com.web.iocs.*" />
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.tiles2.TilesView</value>
</property>
</bean>
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles.xml</value>
</list>
</property>
</bean>
<tx:jta-transaction-manager />
<tx:annotation-driven />
<bean
class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor">
<property name="persistenceUnits">
<map>
<entry key="OCSPersistenceUnit" value="persistence/OCSPersistenceUnit" />
</map>
</property>
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="OCSPersistenceUnit" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="false" />
</bean>
</property>
</bean>
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:messages" />
<property name="defaultEncoding" value="UTF-8" />
</bean>
嘿謝謝你的迴應,但它指出的問題的JBoss爲6,而我使用JBoss AS 7還我使用彈簧3.0.1 –
的問題是,JBoss的從版本6更改VirtualFileVisitor的包,並且在版本3.0.3之前,Spring不會正確處理它。所以使用最新版本的Spring應該可以工作。 –
感謝Julien它的工作 –