gpt4 book ai didi

java - 在 gradle 中添加 apche cxf-bundle 作为依赖项时获取 "Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD exception"

转载 作者:行者123 更新时间:2023-11-30 01:50:43 28 4
gpt4 key购买 nike

尝试在我的应用程序中添加 apache-cxf 包。但是在运行应用程序时出现以下错误 实例化失败 [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping]:工厂方法“payloadRootAnnotationMethodEndpointMapping”抛出异常;嵌套异常是 java.lang.ExceptionInInitializerError

这是由于 引起原因:java.lang.IllegalArgumentException:不支持:http://javax.xml.XMLConstants/property/accessExternalDTD

尝试在任务中添加以下属性

wsdl2java {
System.setProperty('javax.xml.accessExternalSchema', 'all')
System.setProperty('javax.xml.accessExternalDTD','all')
generatedWsdlDir = file("src/main/generated-sources/") // target directory for generated source code
wsdlsToGenerate = [ // 2d-array of wsdls and cxf-parameters
['src/main/resources/xsd/wsdl/***.wsdl'],
]

}

added the dependency as 
compile group: 'org.apache.cxf', name: 'cxf-bundle', version: '2.4.2'

出现以下错误

Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping]: Factory method 'payloadRootAnnotationMethodEndpointMapping' threw exception; nested exception is java.lang.ExceptionInInitializerError

Caused by: java.lang.IllegalArgumentException: Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD
at org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:576) ~[xalan-2.7.1.jar:?]

最佳答案

在检查依赖树时,看到Xalan的多个版本。这使得依赖冲突。通过添加以下行解决错误

 compile (group: 'org.apache.cxf', name: 'cxf-bundle', version: '2.4.2')  {    
exclude module: 'xalan'
}

关于java - 在 gradle 中添加 apche cxf-bundle 作为依赖项时获取 "Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD exception",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56147602/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com