Skip to content

RestTemplate (and probably server side as well) should be able to bootstrap itself if com.sun.org.apache.xalan.* is not available [SPR-17007] #21545

Closed

Description

@spring-projects-issues

Dave Syer opened SPR-17007 and commented

If SourceHttpMessageConverter fails to initialize itself it blows up a RestTemplate and then the whole bean factory on startup:

Caused by: javax.xml.transform.TransformerFactoryConfigurationError: Provider com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl not found
	at java.lang.Throwable.<init>(Throwable.java:265)
	at java.lang.Error.<init>(Error.java:70)
	at javax.xml.transform.TransformerFactoryConfigurationError.<init>(TransformerFactoryConfigurationError.java:91)
	at javax.xml.transform.FactoryFinder.newInstance(FactoryFinder.java:181)
	at javax.xml.transform.FactoryFinder.find(FactoryFinder.java:261)
	at javax.xml.transform.TransformerFactory.newInstance(TransformerFactory.java:106)
	at org.springframework.http.converter.xml.SourceHttpMessageConverter.<init>(SourceHttpMessageConverter.java:86)
	at org.springframework.web.client.RestTemplate.<init>(RestTemplate.java:181)
	at org.springframework.boot.autoconfigure.http.HttpMessageConverters.getDefaultConverters(HttpMessageConverters.java:204)
	at org.springframework.boot.autoconfigure.http.HttpMessageConverters.<init>(HttpMessageConverters.java:106)
	at org.springframework.boot.autoconfigure.http.HttpMessageConverters.<init>(HttpMessageConverters.java:92)
	at org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration.messageConverters(HttpMessageConvertersAutoConfiguration.java:72)

The presence of a default implementation of TransformerFactory appears to be platform dependent, so RestTemplate and friends probably ought not to rely on their existence. E.g. a defensive type check might be needed.


Affects: 5.0.7

Issue Links:

Referenced from: commits b09fad1

Activity

  1. spring-projects-issues commented on Jul 23, 2018

    @spring-projects-issues
    CollaboratorAuthor

    Sébastien Deleuze commented

    The TransactionFactory implementation is very specific and can vary, so I chose to just catch the error thrown when instantiating SourceHttpMessageConverter when no impl is available.

  2. added
    type: enhancement
    in: web
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webtype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions