WildFly 9无法解析服务xml

时间:2016-02-04 08:05:20

标签: jboss wildfly wildfly-9

的jboss-service.xml的:

<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="urn:jboss:service:7.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="urn:jboss:service:7.0 jboss-service_7_0.xsd">
    <mbean name="com.xxx.yyy:service=SomeClass"
        code="com.xxx.yyy.SomeClassBean"  xmbean-dd="META-INF/config-mbeans.xml" />
</server>

我上面有jboss-service.xml,我收到了这个错误:

Caused by: java.lang.IllegalStateException: Current state START_ELEMENT is not among the statesCHARACTERS, COMMENT, CDATA, SPACE, ENTITY_REFERENCE, DTD valid for getText() 
    at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.getText(Unknown Source)
    at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.getText(XMLExtendedStreamReaderImpl.java:275)
    at org.jboss.as.service.descriptor.JBossServiceXmlDescriptorParser.unexpectedContent(JBossServiceXmlDescriptorParser.java:638)
    at org.jboss.as.service.descriptor.JBossServiceXmlDescriptorParser.parseMBean(JBossServiceXmlDescriptorParser.java:221)
    at org.jboss.as.service.descriptor.JBossServiceXmlDescriptorParser.readElement(JBossServiceXmlDescriptorParser.java:192)
    at org.jboss.as.service.descriptor.JBossServiceXmlDescriptorParser.readElement(JBossServiceXmlDescriptorParser.java:48)
    at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110)
    at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69)
    at org.jboss.as.service.ServiceDeploymentParsingProcessor.deploy(ServiceDeploymentParsingProcessor.java:96)
    ... 6 more

知道怎么解决这个问题吗?尝试了其他建议,但似乎没有任何效果。

1 个答案:

答案 0 :(得分:0)

根据JBossAS docs 9.6.2 部分,您需要像这样定义mbean

<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="urn:jboss:service:7.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="urn:jboss:service:7.0 jboss-service_7_0.xsd">
    <mbean code="..." name="...">
    </mbean>
</server>

修改

查看JBossServiceXmlDescriptorParser.java:221的源代码后,可以理解Wildfly 9上不再需要元素xmbean-dd。只需要NAMECODE。< / p>

mbean标记中删除该元素,它将起作用。