获得“ http://javax.xml.xmlconstants/property/accessexternaldtd属性不支持”在Jboss并使用Springboot
在将应用程序升级为Spring Boot 2.6.6与JBOSS 7.3结合使用后,我们对每个XML验证进行了以下警告:
2022-04-13 14:18:39,433 WARN [org.springframework.xml.validation.Jaxp15ValidatorFactory] (default task-2) http://javax.xml.XMLConstants/property/accessExternalDTD property not supported by org.apache.xerces.jaxp.validation.ValidatorImpl
2022-04-13 14:18:39,433 WARN [org.springframework.xml.validation.Jaxp15ValidatorFactory] (default task-1) http://javax.xml.XMLConstants/property/accessExternalSchema property not supported by org.apache.xerces.jaxp.validation.ValidatorImpl
由于大量验证量,JBOSS磁盘被填充了日志警告,导致完整磁盘。
最明显的解决方案是不使用JBOSS,但不幸的是,这在我们的生产环境中是不可能的。
After upgrading our application to spring boot 2.6.6 in combination with JBoss 7.3 we get on every xml validation the following warnings:
2022-04-13 14:18:39,433 WARN [org.springframework.xml.validation.Jaxp15ValidatorFactory] (default task-2) http://javax.xml.XMLConstants/property/accessExternalDTD property not supported by org.apache.xerces.jaxp.validation.ValidatorImpl
2022-04-13 14:18:39,433 WARN [org.springframework.xml.validation.Jaxp15ValidatorFactory] (default task-1) http://javax.xml.XMLConstants/property/accessExternalSchema property not supported by org.apache.xerces.jaxp.validation.ValidatorImpl
Due to the intensive number of validations, the JBoss disk was filled with a log warnings resulting in a full disk.
The most obvious solution is not to use JBoss, but unfortunately that is not possible in our production environment.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
警告的原因是JBOSS 7.3使用不支持属性的旧Xerces库(2.2.12.0.sp03):AccessExternalDTD和AccessExternalDTD和AccessExternalSshema and Spring-boot(2.6.6)期望支持此功能并在何时登录警告。不支持。
通常,您应该更新到Xerces库的较新版本,但是在JBoss的情况下,这是不可能的,因为Xerces库与JBOSS打包。
这样做的解决方案是将JBOSS中的日志记录设置更改为此特定日志记录的错误级别。这可以通过以下命令来完成:
The reason for the warning is that JBoss 7.3 is using an old Xerces library (2.2.12.0.SP03) which does not support the properties: accessExternalDTD and accessExternalSchema and spring-boot (2.6.6) expect support for this and log a warning when it is not supported.
Normally you should update to a newer version of the Xerces library but in the case of JBoss this is not possible because the Xerces library is packaged with JBoss.
The solution for this is to change the logging settings in JBoss to the error level for this particular logging. This can be done with the following commands:
添加
xmlparserv2
依赖项之后遇到了同样的问题,因为突然间,classLoader开始加载oracle.xml.jaxp.jxsaxsaxtransformerfactory
不支持accept> accessects Excessexternaldtdtd
/code>,而不是像以前那样服用transformerfactoryimpl
。发生这种情况是因为现在出现了
javax.xml.transform.transformerfactory
的其他实现,而classloader正在加载错误的解决方案是明确告诉ClassLoader要加载哪个类:
或将其设置为JVM参数
Had the same issue after adding
xmlparserv2
dependency, because all of a sudden the ClassLoader started loading theoracle.xml.jaxp.JXSAXTransformerFactory
which doesn't supportaccessExternalDTD
, instead of taking theTransformerFactoryImpl
like it used to.This happened because now there appeared an additional implementation of the
javax.xml.transform.TransformerFactory
and classloader was loading the wrong one.Solution was to explicitly tell ClassLoader which class to load:
or alternatively set it as JVM argument with
提供的
validatorFactory
的实现不支持上述属性。正如@gerard的答案中提到的,jboss
org.apache.xerces
依赖关系提供了其实现。您可以配置程序以使用支持或忽略上述属性的实现。
我在另一个
The provided implementation of the
ValidatorFactory
doesn't support the mentioned property.As it's mentioned in the answer of @Gerard, JBoss
org.apache.xerces
dependency provides its implementation.You can configure your program to use the implementation that supports or ignores the mentioned property.
I elaborated on the details in another similar answer.