Project

Profile

Help

Bug #5844

closed

Issue when using Jakarta JAXB Implementation

Added by Jeff Schenk almost 2 years ago. Updated almost 2 years ago.

Status:
Duplicate
Priority:
High
Assignee:
-
Category:
JAXP Java API
Sprint/Milestone:
-
Start date:
2023-01-21
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
10
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

Issue when using Jakarta JAXB Implementation

Using saxonica-EE 10.1, licensed version. Java Version 17 Spring Boot 3.0.1 Spring Framework 6.0.3

Issue when migrating to new Spring Boot 3.0.0, which requires the Jakarta JAXP Implementation to used causes the following stack trace when atempting to perform a transformation:

java.lang.IllegalArgumentException: Unrecognized configuration feature: http://javax.xml.XMLConstants/property/accessExternalDTD at net.sf.saxon.Configuration.setConfigurationProperty(Configuration.java:4298) at com.saxonica.config.ProfessionalConfiguration.setConfigurationProperty(ProfessionalConfiguration.java:255) at net.sf.saxon.jaxp.SaxonTransformerFactory.setAttribute(SaxonTransformerFactory.java:315) at com.saxonica.config.ProfessionalTransformerFactory.setAttribute(ProfessionalTransformerFactory.java:62) at com.saxonica.config.EnterpriseTransformerFactory.setAttribute(EnterpriseTransformerFactory.java:86) at com.sun.xml.messaging.saaj.util.transform.EfficientStreamingTransformer.(EfficientStreamingTransformer.java:84) at com.sun.xml.messaging.saaj.util.transform.EfficientStreamingTransformer.newTransformer(EfficientStreamingTransformer.java:419) at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.parseEnvelopeSax(EnvelopeFactory.java:180) at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:95) at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:51) at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:142) at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:181) at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:61) at org.springframework.ws.transport.AbstractWebServiceConnection.receive(AbstractWebServiceConnection.java:89) at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:86) at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:60) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1080) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:973) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1010) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:913) at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:884) at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:814) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:223) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) at org.springframework.web.servlet.resource.ResourceUrlEncodingFilter.doFilter(ResourceUrlEncodingFilter.java:66) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:109) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:119) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:400) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:859) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1734) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:833)

Is there a way to configure Saxonica perhaps in a newer version to use Jakarta?

Please advise asap, as this is blocking migration.

Sincerely, Jeff Schenk


Related issues

Is duplicate of Saxon - Bug #4729: TransformerFactory doesn't accept ACCESS_EXTERNAL_STYLESHEET propertyClosedMichael Kay2020-09-11

Actions
Actions #1

Updated by Martin Honnen almost 2 years ago

I can confirm that e.g.

    EnterpriseTransformerFactory tf = new EnterpriseTransformerFactory();
    tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "http,https");

throws the above exception in EE 10.1 but in none of the currently supported releases, i.e. the example works fine in EE 10.8, EE 11.4 and EE 12.0.

Actions #2

Updated by Martin Honnen almost 2 years ago

https://saxonica.plan.io/issues/4729#note-10 suggests that 10.3 is the first release to support setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD

Actions #3

Updated by Jeff Schenk almost 2 years ago

Is here a specific download link for 10.3?

Thank you, Jeff

Actions #4

Updated by Martin Honnen almost 2 years ago

For the 10.x branch the latest and therefore recommended maintenance update is 10.8, linked from https://www.saxonica.com/download/information.xml#earlier as http://www.saxonica.com/download/SaxonEE10-8J.zip.

If you really want to go to 10.3 then I would think that changing that link to http://www.saxonica.com/download/SaxonEE10-3J.zip gives you that version.

Actions #5

Updated by Michael Kay almost 2 years ago

See bug #4729, fixed in Saxon 10.3.

What you've got here is an application (com.sun.xml.messaging.saaj.util.transform.EfficientStreamingTransformer) that's using the JAXP API to find an XSLT transformation service. The JAXP specification says that it will get whatever transformation service it finds on the classpath, and the one it's picking up happens to be Saxon 10.1. But the application is assuming that it will find a transformation service that recognises the property http://javax.xml.XMLConstants/property/accessExternalDTD.

The Javadoc specification of TransformerFactory says that "an implementation that supports JAXP 1.5 or newer" must recognise this property. But there are plenty of implementations of TransformerFactory that were written against older versions of the JAXP specification, and Saxon 10.1 is one of them. If the application relies on this property being supported, then it's going to fail if there is a TransformerFactory on the classpath that doesn't support it.

Note that even with later versions of Saxon, an application that relies on the JAXP loading mechanism is very likely to fail if it finds an XSLT transformation engine that it hasn't been tested with, because many aspects of the API are implementation-defined.

Actions #6

Updated by Michael Kay almost 2 years ago

  • Is duplicate of Bug #4729: TransformerFactory doesn't accept ACCESS_EXTERNAL_STYLESHEET property added
Actions #7

Updated by Michael Kay almost 2 years ago

  • Status changed from New to Duplicate
Actions #8

Updated by Michael Kay almost 2 years ago

I would just add one note: the Javadoc for TransformerFactory is thoroughly misleading when it says

Access to external DTDs in the source file is restricted to the protocols specified by the XMLConstants.ACCESS_EXTERNAL_DTD property.

because the XSLT engine has no way of controlling this. It's up to the XML parser to police access to external DTDs, the XSLT processor has no control over the matter, except on paths where the XSLT processor creates and/or configures the XML parser. And one of the many (huge) gaps in the JAXP specification is that it doesn't say whether an XSLT processor is expected to change the configuration of a user-supplied XML parser.

Sadly the evolution of the JAXP specification has never involved consultation with multiple implementors. New provisions like this just appear in the specs out of the blue without consultation or announcement, and the result is (a) that it is often underspecified, and (b) that the changes can go unnoticed for a significant length of time.

Actions #9

Updated by Jeff Schenk almost 2 years ago

Running at least 10.8 of Saxonica-EE for Java resolved the issue.

Many thanks, Jeff

Please register to edit this issue

Also available in: Atom PDF