camel-k: [Regression] javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found

I am not sure what changed but since yesterday I am suddenly getting an error when trying to run a saxon-xslt:

// camel-k: resource=file:common_json2xml.xslt

from('timer:saxontest?period=10000')
  .setBody(constant("<data>{\"name\":\"John\", \"age\":30, \"car\":null}</data>"))
  .to('xslt-saxon:file:/etc/camel/resources/common_json2xml.xslt')
  .to("log:info?showBody=true&showHeaders=true") `

The XSLT common_json2xml.xslt has the following content:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:fn="http://www.w3.org/2005/xpath-functions"
                xsi:schemaLocation="http://www.w3.org/1999/XSL/Transform https://www.w3.org/2007/schema-for-xslt20.xsd"
                exclude-result-prefixes="xs fn xsi">

    <xsl:output method="xml" encoding="UTF-8" byte-order-mark="no" omit-xml-declaration="yes" indent="yes"  />

    <xsl:template match="/data">
        <xsl:copy-of select="json-to-xml(.)"/>
    </xsl:template>

 </xsl:stylesheet>

I get the following error:

[1] 2023-04-21 09:00:38,513 ERROR [io.qua.run.Application] (main) Failed to start application (with profile [prod]): javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found
[1]     at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
[1]     at org.xmlresolver.ResolverFeature.lambda$static$0(ResolverFeature.java:408)
[1]     at org.xmlresolver.cache.ResourceCache.reset(ResourceCache.java:208)
[1]     at org.xmlresolver.cache.ResourceCache.<init>(ResourceCache.java:145)
[1]     at org.xmlresolver.XMLResolverConfiguration.getFeature(XMLResolverConfiguration.java:1098)
[1]     at org.xmlresolver.CatalogResolver.<init>(CatalogResolver.java:51)
[1]     at org.xmlresolver.Resolver.<init>(Resolver.java:68)
[1]     at net.sf.saxon.lib.CatalogResourceResolver.<init>(CatalogResourceResolver.java:46)
[1]     at net.sf.saxon.Configuration.init(Configuration.java:367)
[1]     at net.sf.saxon.Configuration.<init>(Configuration.java:230)
[1]     at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[1]     at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[1]     at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[1]     at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
[1]     at java.base/java.lang.Class.newInstance(Class.java:584)
[1]     at net.sf.saxon.Configuration.newConfiguration(Configuration.java:246)
[1]     at net.sf.saxon.s9api.Processor.<init>(Processor.java:69)
[1]     at net.sf.saxon.jaxp.SaxonTransformerFactory.<init>(SaxonTransformerFactory.java:59)
[1]     at net.sf.saxon.TransformerFactoryImpl.<init>(TransformerFactoryImpl.java:42)
[1]     at org.apache.camel.component.xslt.saxon.XsltSaxonEndpoint.createXsltBuilder(XsltSaxonEndpoint.java:202)
[1]     at org.apache.camel.component.xslt.saxon.XsltSaxonEndpoint.doInit(XsltSaxonEndpoint.java:168)

This was still working yesterday morning. Not sure what has changed. I have not upgraded Camel-K. Bot CLI and operator are a 1.12.0.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 19 (10 by maintainers)

Most upvoted comments

Has anybody looked into this? XML-Processing does not work in Camel-K until this is fixed.

If there is anything I can do, plz let me know.

I am 99% positive this not related to the dependencies in the camel component but to the old JAXP way to instantiate the XML processor/XSLT factory. JAXP relies on some really weird reflection stuff to instantiate the XML processing components. This seems to be a source of problems for Quarkus (see quarks/quarkus #1769)[https://github.com/quarkusio/quarkus/issues/1762].

I am not sure why Saxon version 10 works but version 11 doesn’t but I assume that some JAXP related stuff was removed from Saxon 11. Or Quarkus since tokenize seems to be affected, too.

I don’t think the base image changed.