Skip to content

add try-catch-block for XMLConstants.ACCESS_EXTERNAL_DTD #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

Martin-Luft
Copy link

The XMLConstants.ACCESS_EXTERNAL_DTD property is not supported by every
XML library.

Since 3.0.6 I get this error:

ContextLoader.initWebApplicationContext:312 - Context initialization failed
java.lang.IllegalArgumentException: Unrecognized configuration feature: http://javax.xml.XMLConstants/property/accessExternalDTD
	at net.sf.saxon.Configuration.setConfigurationProperty(Configuration.java:4387)
	at net.sf.saxon.jaxp.SaxonTransformerFactory.setAttribute(SaxonTransformerFactory.java:311)
	at org.springframework.xml.transform.TransformerFactoryUtils.defaultSettings(TransformerFactoryUtils.java:53)
	at org.springframework.xml.transform.TransformerFactoryUtils.newInstance(TransformerFactoryUtils.java:32)
	at org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping.<clinit>(PayloadRootAnnotationMethodEndpointMapping.java:58)

The XMLConstants.ACCESS_EXTERNAL_DTD property is not supported by every
XML library.

Since 3.0.6 I get this error:

ContextLoader.initWebApplicationContext:312 - Context initialization
failed
java.lang.IllegalArgumentException: Unrecognized configuration feature:
http://javax.xml.XMLConstants/property/accessExternalDTD
	at
net.sf.saxon.Configuration.setConfigurationProperty(Configuration.java:4387)
	at
net.sf.saxon.jaxp.SaxonTransformerFactory.setAttribute(SaxonTransformerFactory.java:311)
	at
org.springframework.xml.transform.TransformerFactoryUtils.defaultSettings(TransformerFactoryUtils.java:53)
	at
org.springframework.xml.transform.TransformerFactoryUtils.newInstance(TransformerFactoryUtils.java:32)
	at
org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping.<clinit>(PayloadRootAnnotationMethodEndpointMapping.java:58)
gregturn added a commit that referenced this pull request Jan 11, 2019
@gregturn
Copy link
Contributor

Superceded by #129.

You can try my patch with 3.0.7.BUILD-SNAPSHOT.

@gregturn gregturn closed this Jan 11, 2019
@tan9
Copy link

tan9 commented Jan 15, 2019

For reference, 3.0.6 doesn't work with Xalan either:

Caused by: java.lang.IllegalArgumentException: Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD
    at org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:571) ~[xalan-2.7.2.jar:na]
    at org.springframework.xml.transform.TransformerFactoryUtils.defaultSettings(TransformerFactoryUtils.java:53) ~[spring-xml-3.0.6.RELEASE.jar:na]
    at org.springframework.xml.transform.TransformerFactoryUtils.newInstance(TransformerFactoryUtils.java:32) ~[spring-xml-3.0.6.RELEASE.jar:na]
    at org.springframework.xml.transform.TransformerHelper.newTransformerFactory(TransformerHelper.java:88) ~[spring-xml-3.0.6.RELEASE.jar:na]
    at org.springframework.xml.transform.TransformerHelper.getTransformerFactory(TransformerHelper.java:104) ~[spring-xml-3.0.6.RELEASE.jar:na]
    at org.springframework.xml.transform.TransformerHelper.createTransformer(TransformerHelper.java:119) ~[spring-xml-3.0.6.RELEASE.jar:na]
    at org.springframework.xml.transform.TransformerHelper.transform(TransformerHelper.java:131) ~[spring-xml-3.0.6.RELEASE.jar:na]
    at org.springframework.xml.transform.TransformerObjectSupport.transform(TransformerObjectSupport.java:96) ~[spring-xml-3.0.6.RELEASE.jar:na]
    at org.springframework.ws.wsdl.wsdl11.provider.InliningXsdSchemaTypesProvider.getSchemaElement(InliningXsdSchemaTypesProvider.java:113) ~[spring-ws-core-3.0.6.RELEASE.jar:na]
    at org.springframework.ws.wsdl.wsdl11.provider.InliningXsdSchemaTypesProvider.addTypes(InliningXsdSchemaTypesProvider.java:101) ~[spring-ws-core-3.0.6.RELEASE.jar:na]
    at org.springframework.ws.wsdl.wsdl11.ProviderBasedWsdl4jDefinition.afterPropertiesSet(ProviderBasedWsdl4jDefinition.java:234) ~[spring-ws-core-3.0.6.RELEASE.jar:na]
    at org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition.afterPropertiesSet(DefaultWsdl11Definition.java:183) ~[spring-ws-core-3.0.6.RELEASE.jar:na]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1741) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
    ... 19 common frames omitted

@gregturn
Copy link
Contributor

Have you tried 3.0.7.BUILD-SNAPSHOT @tan9?

@tan9
Copy link

tan9 commented Jan 15, 2019

@gregturn I haven't. We ended up removing Xalan from classpath (which is a transitive dependency of batik-dom).

However the change you made seems reasonable. 👍

@vetrip
Copy link

vetrip commented Mar 8, 2019

i did recently upgrade the spring-ws version due to security issue cve-2019-3773 to 2.4.4 afterwards i started seeing the below startup error for Weblogic 12.1.1/Jdk 1.6 , Is there an way we can resolve or apply this patch to 2.4.x version ?

Caused By: java.lang.IllegalArgumentException: TransformerFactory does not recognise attribute 'http://javax.xml.XMLConstants/property/accessExternalDTD'.
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:370)
at weblogic.xml.jaxp.WebLogicTransformerFactory.setAttribute(WebLogicTransformerFactory.java:249)

@gregturn
Copy link
Contributor

gregturn commented Mar 8, 2019

Check 2.4.5.release.

@vetrip
Copy link

vetrip commented Mar 8, 2019

Yes i have tried that even 2.4.5 does not handle the IllegalArgumentException which leads to an runtime error during startup. Looks like TransformerFactoryImpl from JDK 6 does not support this property only JDK 7 does but the spring-ws 2.4 is compatible with JDK 6 as per the doc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants