英文:
Quarkus 1.3 cannot instantiate SAXParserFactory
问题
我在从Quarkus 1.2.x升级到1.3.x时遇到了一个SAX解析器的问题。
在Quarkus 1.3.x中失败的两个用例:使用saxon-HE 10.0来通过XSLT转换XML,以及使用docx4j-JAXB-ReferenceImpl 8.1.6来创建OPC包。
两者在javax.xml.parsers.SAXParserFactory.newInstance()处失败,错误消息为"javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found"
。
在使用Quarkus 1.2.x时,SAXParserFactory成功创建com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl。
当我尝试使用系统属性javax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
启动Quarkus 1.3.x时,
我收到以下错误信息:
java.lang.ClassCastException:
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl cannot be cast to class javax.xml.parsers.SAXParserFactory
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl is in module java.xml of loader 'bootstrap';
javax.xml.parsers.SAXParserFactory is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader
从发布说明中https://github.com/quarkusio/quarkus/releases/tag/1.3.0.Final,我无法获取到可能导致此行为更改的线索,因此我会很高兴听取建议。
谢谢!
英文:
I have a SAX Parser Problem when upgrading from Quarkus 1.2.x to 1.3.x.
2 use cases which fail in Quarkus 1.3.x: saxon-HE 10.0 to transform XML via XSLT and docx4j-JAXB-ReferenceImpl 8.1.6 to create OPC packages.
Both fail in javax.xml.parsers.SAXParserFactory.newInstance() with the message "javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found"
Using Quarkus 1.2.x SAXParserFactory successfully creates com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl.
When I try to start Quarkus 1.3.x with a system property javax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
I receive
java.lang.ClassCastException:
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl cannot be cast to class javax.xml.parsers.SAXParserFactory
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl is in module java.xml of loader 'bootstrap';
javax.xml.parsers.SAXParserFactory is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader
From the release notes at https://github.com/quarkusio/quarkus/releases/tag/1.3.0.Final I could not grab a hint what could have changed this behaviour, so I would be glad for an advice.
Thank you!
答案1
得分: 0
org.apache.xmlgraphics:fop具有传递依赖关系xml-apis:xml-apis。
必须将其排除,然后使用Saxon进行的XSLT转换也适用于Quarkus 1.3。
但是为什么在Quarkus 1.3中不排除就无法工作,而在Quarkus 1.2中可以,我不清楚。也许Quarkus团队的某位成员可以解释一下这个问题。
英文:
org.apache.xmlgraphics:fop has the transitive dependency xml-apis:xml-apis.
This has to be excluded, then the XSLT transformation with Saxon also works with Quarkus 1.3.
But why it does not work without exclusion in Quarkus 1.3, but does in Quarkus 1.2, I have no idea. Maybe someone of the quarkus team could shed some light on this.
专注分享java语言的经验与见解,让所有开发者获益!
评论