是什么原因导致这个"Unexpected element"在 JBoss 配置中抛出 XMLStreamValidationException?



我正在尝试将一些软件从 JBoss 5 迁移到 JBoss 7。我卡住了,因为我的部署失败,出现以下异常。请记住,该软件在 JBoss 5 中运行,所以我认为任何不工作的东西都应该是因为 JBoss 5/7 之间的差异。

有问题的行(异常中指出的第 12 行(如下:

<application-policy xmlns="urn:jboss:security-beans:1.0" name="MyProjectDatabaseLogin">

错误/异常是:

ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."myear.ear".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."myear.ear".PARSE: WFLYSRV0153: Failed to process phase PARSE of deployment "myear.ear"
[stack trace omitted]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYPOJO0038: Exception while parsing POJO descriptor file: "/content/myear.ear/META-INF/myproject-auth-jboss-beans.xml"
[stack trace omitted]
Caused by: org.projectodd.vdx.core.XMLStreamValidationException: ParseError at [row,col]:[12,4]
Message: ParseError at [row,col]:[12,4]
Message: WFLYCTL0198: Unexpected element '{urn:jboss:security-beans:1.0}application-policy' encountered
[stack trace omitted]
ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "myear.ear")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit."myear.ear".PARSE" => "WFLYSRV0153: Failed to process phase PARSE of deployment "myear.ear"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYPOJO0038: Exception while parsing POJO descriptor file: "/content/myear.ear/META-INF/myproject-auth-jboss-beans.xml"
Caused by: org.projectodd.vdx.core.XMLStreamValidationException: ParseError at [row,col]:[12,4]
Message: ParseError at [row,col]:[12,4]
Message: WFLYCTL0198: Unexpected element '{urn:jboss:security-beans:1.0}application-policy' encountered"}}

为什么application-policy(或其xmlns值(在这里出乎意料?导致此异常的原因是什么?


我不得不手动输入上面的xml行和错误/异常,因此可能存在一些实际上不存在的拼写错误,这些拼写错误实际上并没有导致问题,尽管我已经在这里重读了几次我的问题,我认为我没有错别字上面。

我最终发现这些可配置的项目不再应该在同一个文件中。此信息现在应该在服务器的配置文件中,因此您可能会将其放入domain.xml文件或standalone.xml文件中。

这是一个安全应用程序策略,因此此标记的内容现在进入<security-domain>标记中的<security-domains>部分。

所以它会像下面这样。请注意,<application-policy ...>现在已<security-domain ...>,并且位于<security-domains>内。另外,我以前的安全应用程序策略中有两个<login-module>,但是如果使用新的鞘翅安全系统,则安全域中只允许 1 个<login-module>标签......

...
<security-domains> <!-- Search for this in the file and put the migrated part into here -->
<security-domain name="MySecurityDomain">
... all the stuff that used to be in the security application policy
... note that some of the stuff you put in here might need to change depending on the security system used
</security-domain>
</security-domains>
...

最新更新