我在尝试启动WildFly 10.1时遇到了解析错误,但我的standalone.xml
似乎有效。 (我通过XML Validator运行整个文件,但没有出现任何错误。)
16:52:50,107 INFO [org.jboss.modules] (main) JBoss Modules version 1.5.2.Final
16:52:50,559 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
16:52:50,668 INFO [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Servlet 10.1.0.Final (WildFly Core 2.2.0.Final) starting
16:52:51,678 ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0055: Caught exception during boot: org.jboss.as.controller.persistence.Configuratio
nPersistenceException: WFLYCTL0085: Failed to parse configuration
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:131) [wildfly-controller-2.2.0.Final.jar:2.2.0.F
inal]
at org.jboss.as.server.ServerService.boot(ServerService.java:357) [wildfly-server-2.2.0.Final.jar:2.2.0.Final]
at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:299) [wildfly-controller-2.2.0.Final.jar:2.2.0.Final]
at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_131]
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[193,9]
Message: Unexpected element '{urn:jboss:domain:datasources:4.0}subsystem'
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:108) [staxmapper-1.2.0.Final.jar:1.2.0.Final]
at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69) [staxmapper-1.2.0.Final.jar:1.2.0.Final]
at org.jboss.as.server.parsing.StandaloneXml_4.parseServerProfile(StandaloneXml_4.java:546) [wildfly-server-2.2.0.Final.jar:2.2.0.Final]
at org.jboss.as.server.parsing.StandaloneXml_4.readServerElement(StandaloneXml_4.java:242) [wildfly-server-2.2.0.Final.jar:2.2.0.Final]
at org.jboss.as.server.parsing.StandaloneXml_4.readElement(StandaloneXml_4.java:141) [wildfly-server-2.2.0.Final.jar:2.2.0.Final]
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:103) [wildfly-server-2.2.0.Final.jar:2.2.0.Final]
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:49) [wildfly-server-2.2.0.Final.jar:2.2.0.Final]
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.2.0.Final.jar:1.2.0.Final]
at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69) [staxmapper-1.2.0.Final.jar:1.2.0.Final]
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:123) [wildfly-controller-2.2.0.Final.jar:2.2.0.F
inal]
... 3 more
16:52:51,709 FATAL [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messa
ges for details.
16:52:51,740 INFO [org.jboss.as] (MSC service thread 1-3) WFLYSRV0050: WildFly Servlet 10.1.0.Final (WildFly Core 2.2.0.Final) stopped in 22ms
以下是从第192行开始的standalone.xml
行(前一个子系统的结尾;注意第193行引发错误)。
</subsystem>
<subsystem xmlns="urn:jboss:domain:datasources:4.0">
<datasources>
<drivers>
<driver module="com.mysql.jdbc" name="com.mysql.jdbc">
<driver-class>com.mysql.jdbc.Driver</driver-class>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
</profile>
<interfaces>
我当然使用module.xml
为驱动程序定义了模块。但是,WildFly似乎没有尝试阅读module.xml
,因为它认为standalone.xml
中存在解析器错误。
我尝试将版本从4.0更改为2.0或1.2,这没有任何区别。
似乎WildFly不希望在这里找到subsystem
元素。但subsystem
元素中有大量其他profile
元素, 这些 不会产生解析错误。
我甚至尝试在前一个datasources
元素(subsystem
)之前移动subsystem
undertow
元素,但这也没有对结果产生任何影响。
任何人都可以解释为什么它会像这样表现吗?
答案 0 :(得分:1)
我最终发现了这个问题。任何子系统都有自己的XML命名空间,必须在WildFly下的\ docs \ schema目录中的XSD文件中定义。在这种情况下,应该有一个“wildfly-datasources_4_0.xsd”文件,但它丢失了。 (我的WildFly安装似乎基于WildFly的“仅servlet分发”,它不包含此文件。)这就是解析错误的原因。