Trying to add an apache-cxf bundle in my application.But getting the following error while running the application Failed to instantiate [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping]: Factory method 'payloadRootAnnotationMethodEndpointMapping' threw exception; nested exception is java.lang.ExceptionInInitializerError
which is caused by Caused by: java.lang.IllegalArgumentException: Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD
Tried to add the following properties in the task
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'
getting the following error
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:?]
While checking the dependency tree, Seeing multiple version of Xalan.Which make the dependency conflict. Error is resolved by adding the following line
compile (group: 'org.apache.cxf', name: 'cxf-bundle', version: '2.4.2') {
exclude module: 'xalan'
}