无法在Wildfly 8.2中使用本机JDBC应用程序部署Spring?

时间:2015-05-19 07:21:00

标签: xml spring jboss wildfly wildfly-8

在Wildfly 8.2中,无法使用本机JDBC应用程序部署Spring,

使用Java1.8和Wildfly 8.2,

因为我在WEB-INF / lib中有Spring Libs

我的applicationcontext.xml文件是:

 <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:jee="http://www.springframework.org/schema/jee"
           xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
           xmlns:tx="http://www.springframework.org/schema/tx"
            xmlns:p="http://www.springframework.org/schema/p"

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
                http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
                http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.1.xsd
                http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd
                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd">

我的web.xml文件是:

<?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5"> 
 <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/appctx/applicationContext*.xml</param-value>
  </context-param>

异常日志是:

13:26:40,814 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8
.2.0.Final "Tweek" started in 6615ms - Started 234 of 290 services (90 services
are lazy, passive or on-demand)
13:26:55,961 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBA
S015876: Starting deployment of "Test_JB60_Testing.war" (runtime-name: "T
est_JB60_Testing.war")
13:27:01,733 INFO  [io.undertow.servlet] (MSC service thread 1-3) Initializing S
pring root WebApplicationContext
13:27:01,733 INFO  [org.springframework.web.context.ContextLoader] (MSC service
thread 1-3) Root WebApplicationContext: initialization started
13:27:03,059 INFO  [org.springframework.web.context.support.XmlWebApplicationCon
text] (MSC service thread 1-3) Refreshing Root WebApplicationContext: startup da
te [Mon May 18 13:27:03 IST 2015]; root of context hierarchy
13:27:03,343 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReade
r] (MSC service thread 1-3) Loading XML bean definitions from ServletContext res
ource [/WEB-INF/appctx/applicationContext-jdbc.xml]
13:27:05,134 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReade
r] (MSC service thread 1-3) Loading XML bean definitions from ServletContext res
ource [/WEB-INF/appctx/applicationContext.xml]
13:27:08,747 SEVERE [org.springframework.web.context.ContextLoader] (MSC service
 thread 1-3) Context initialization failed: org.springframework.beans.factory.pa
rsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Sp
ring NamespaceHandler for XML schema namespace [http://www.springframework.org/s
chema/context]
Offending resource: ServletContext resource [/WEB-INF/appctx/applicationContext.
xml]

        at org.springframework.beans.factory.parsing.FailFastProblemReporter.err
or(FailFastProblemReporter.java:70) [spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEAS
E]
        at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderC
ontext.java:85) [spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderC
ontext.java:80) [spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.er
ror(BeanDefinitionParserDelegate.java:316) [spring-beans-4.1.6.RELEASE.jar:4.1.6
.RELEASE]
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.pa
rseCustomElement(BeanDefinitionParserDelegate.java:1424) [spring-beans-4.1.6.REL
EASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.pa
rseCustomElement(BeanDefinitionParserDelegate.java:1417) [spring-beans-4.1.6.REL
EASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe
ader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:174) [spring-
beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe
ader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:144) [sp
ring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe
ader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:100) [spri
ng-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registe
rBeanDefinitions(XmlBeanDefinitionReader.java:510) [spring-beans-4.1.6.RELEASE.j
ar:4.1.6.RELEASE]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadB
eanDefinitions(XmlBeanDefinitionReader.java:392) [spring-beans-4.1.6.RELEASE.jar
:4.1.6.RELEASE]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:336) [spring-beans-4.1.6.RELEASE.jar:4
.1.6.RELEASE]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:304) [spring-beans-4.1.6.RELEASE.jar:4
.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReade
r.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181) [spring-beans-4.1.6
.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReade
r.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217) [spring-beans-4.1.6
.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReade
r.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188) [spring-beans-4.1.6
.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.web.context.support.XmlWebApplicationContext.load
BeanDefinitions(XmlWebApplicationContext.java:125) [spring-web-4.1.6.RELEASE.jar
:4.1.6.RELEASE]
        at org.springframework.web.context.support.XmlWebApplicationContext.load
BeanDefinitions(XmlWebApplicationContext.java:94) [spring-web-4.1.6.RELEASE.jar:
4.1.6.RELEASE]
        at org.springframework.context.support.AbstractRefreshableApplicationCon
text.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129) [spring-
context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.obtain
FreshBeanFactory(AbstractApplicationContext.java:537) [spring-context-4.1.6.RELE
ASE.jar:4.1.6.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:452) [spring-context-4.1.6.RELEASE.jar:4.1.6.R
ELEASE]
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebA
pplicationContext(ContextLoader.java:403) [spring-web-4.1.6.RELEASE.jar:4.1.6.RE
LEASE]
        at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:306) [spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:106) [spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]

        at io.undertow.servlet.core.ApplicationListeners.contextInitialized(Appl
icationListeners.java:173) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManag
erImpl.java:193) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.s
tartContext(UndertowDeploymentService.java:87)
        at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.s
tart(UndertowDeploymentService.java:72)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
rviceControllerImpl.java:1948)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
rollerImpl.java:1881)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1142) [rt.jar:1.8.0_40]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:617) [rt.jar:1.8.0_40]
        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_40]

13:27:08,800 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC0000
01: Failed to start service jboss.undertow.deployment.default-server.default-hos
t./: org.jboss.msc.service.StartException in service jboss.undertow.deployment.d
efault-server.default-host./: Failed to start service
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
rollerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1142) [rt.jar:1.8.0_40]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:617) [rt.jar:1.8.0_40]
        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_40]
Caused by: java.lang.RuntimeException: org.springframework.beans.factory.parsing
.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring
NamespaceHandler for XML schema namespace [http://www.springframework.org/schema
/context]
Offending resource: ServletContext resource [/WEB-INF/appctx/applicationContext.
xml]

        at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManag
erImpl.java:222)
        at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.s
tartContext(UndertowDeploymentService.java:87)
        at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.s
tart(UndertowDeploymentService.java:72)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
rviceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
rollerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
        ... 3 more
Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingExcept
ion: Configuration problem: Unable to locate Spring NamespaceHandler for XML sch
ema namespace [http://www.springframework.org/schema/context]
Offending resource: ServletContext resource [/WEB-INF/appctx/applicationContext.
xml]

        at org.springframework.beans.factory.parsing.FailFastProblemReporter.err
or(FailFastProblemReporter.java:70)
        at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderC
ontext.java:85)
        at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderC
ontext.java:80)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.er
ror(BeanDefinitionParserDelegate.java:316)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.pa
rseCustomElement(BeanDefinitionParserDelegate.java:1424)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.pa
rseCustomElement(BeanDefinitionParserDelegate.java:1417)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe
ader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:174)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe
ader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:144)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe
ader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:100)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registe
rBeanDefinitions(XmlBeanDefinitionReader.java:510)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadB
eanDefinitions(XmlBeanDefinitionReader.java:392)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:336)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:304)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReade
r.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReade
r.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReade
r.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
        at org.springframework.web.context.support.XmlWebApplicationContext.load
BeanDefinitions(XmlWebApplicationContext.java:125)
        at org.springframework.web.context.support.XmlWebApplicationContext.load
BeanDefinitions(XmlWebApplicationContext.java:94)
        at org.springframework.context.support.AbstractRefreshableApplicationCon
text.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
        at org.springframework.context.support.AbstractApplicationContext.obtain
FreshBeanFactory(AbstractApplicationContext.java:537)
        at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:452)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebA
pplicationContext(ContextLoader.java:403)
        at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:306)
        at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:106)
        at io.undertow.servlet.core.ApplicationListeners.contextInitialized(Appl
icationListeners.java:173)
        at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManag
erImpl.java:193)
        ... 7 more

13:27:08,831 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "Test_JB60_Testing.war")]) - failure description: {"JBAS014671: F
ailed services" => {"jboss.undertow.deployment.default-server.default-host./" =>
 "org.jboss.msc.service.StartException in service jboss.undertow.deployment.defa
ult-server.default-host./: Failed to start service
    Caused by: java.lang.RuntimeException: org.springframework.beans.factory.par
sing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/sc
hema/context]
Offending resource: ServletContext resource [/WEB-INF/appctx/applicationContext.
xml]

    Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingEx
ception: Configuration problem: Unable to locate Spring NamespaceHandler for XML
 schema namespace [http://www.springframework.org/schema/context]
Offending resource: ServletContext resource [/WEB-INF/appctx/applicationContext.
xml]
"}}
13:27:08,912 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018
559: Deployed "Test_JB60_Testing.war" (runtime-name : "Test_JB60_T
esting.war")
13:27:08,912 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBA
S014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.undertow.deploy
ment.default-server.default-host./: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./: Failed to start service

问题的原因是什么?
任何解决方案都要提前感谢。

1 个答案:

答案 0 :(得分:0)

找到解决方案:

将spring模块名称作为依赖项添加到jboss-deployment-structure.xml中作为

<module name="org.springframework" export="true" meta-inf="import" services="import" slot="main" />

并部署您的应用程序,它将起作用。

谢谢。