【问题标题】:Using Saxon to process XPath in a JIRA module使用 Saxon 处理 JIRA 模块中的 XPath
【发布时间】:2014-05-24 06:01:09
【问题描述】:

我想使用 saxon 来处理 jira 模块中的 xpath。 覆盖有问题代码的单元测试在 eclipse 中运行良好,所以我已经部署了模块,并且 ...

我遇到了可怕的

java.lang.ClassCastException:org.apache.xerces.jaxp.SAXParserFactoryImpl 无法转换为 javax.xml.parsers.SAXParserFactory(请参阅Dealing with "Xerces hell" in Java/Maven?

我试图从 saxon 依赖项中排除 xml-apis,正如 https://answers.atlassian.com/questions/104121/i-m-blocked-help-cannot-be-cast-to-javax-xml-parsers-saxparserfactory 中所建议的那样

现在我丢失了 w3c.dom,这很奇怪,因为我敢打赌它存在于 jira 的某个地方。 尽管如此,我还是将 dom4j 添加到 pom 依赖项中,并得到了

java.lang.NoClassDefFoundError: 无法初始化类 net.sf.saxon.Configuration

没有指出缺少哪个类。

这是最初出现问题的代码: https://github.com/magwas/andreymarkelov-atlas-plugins-requestedfields/tree/feature/xsltfixes

导致当前状态的补丁位于http://pastebin.com/vwR43hHt

解决办法是什么?

【问题讨论】:

    标签: java maven jira saxon xerces


    【解决方案1】:

    好的,想通了。我不知道为什么,所以欢迎分析。

         <dependency>
           <groupId>net.sf.saxon</groupId>
           <artifactId>Saxon-HE</artifactId>
           <version>9.4</version>
           <exclusions>
            <exclusion>
                <artifactId>xom</artifactId>
                <groupId>xom</groupId>
            </exclusion>
            <exclusion>
                <artifactId>dom4j</artifactId>
                <groupId>dom4j</groupId>
            </exclusion>
           </exclusions>
         </dependency>
    

    【讨论】:

    • 暂时删除您的排除项,为 groupId=com.atlassian.jira、artifactId=jira-core、version=yourJiraVersion、scope=provided 添加临时依赖项,然后运行 ​​atlas-mvn dependency:tree。这将向您显示项目的所有传递依赖项,因此您将能够看到正在使用哪些其他 xerces 类型的模块。您还可以查看手动包含的 saxon 模块的所有依赖项,并查看它们在 JIRA 中的重复内容。
    猜你喜欢
    • 2021-08-30
    • 2012-02-18
    • 2010-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-04
    相关资源
    最近更新 更多