java.lang.NoSuchFieldError : reportUnusedDeclaredThrownExceptionIncludeDocCommentReference 错误

标签 java javascript exception gwt smartgwt

我得到了异常

java.lang.NoSuchFieldError: reportUnusedDeclaredThrownExceptionIncludeDocCommentReference 在命令行中使用 maven 的 eclipse 之外。

gwt 库在依赖项列表的顶部声明,并且正在使用 GWT 2.5.1。 如何解决这个问题?请帮忙

最佳答案

好吧,我想出了问题所在。 在我的 pom.xml 中,我有这种依赖性

<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>4.7.0</version>

问题在于,jasper 报告依赖于 jdtcore

        <dependency>
        <artifactId>jdtcore</artifactId>
        <groupId>eclipse</groupId>
        <version>3.1.0</version>
    </dependency>

jdtcore 实际上与 gwt 编译器产生了冲突。为了解决这个问题,我需要像这样在 jasper 依赖中添加一个排除

        <dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports</artifactId>
        <version>4.7.0</version>
        <exclusions>
            <exclusion>
                <artifactId>jdtcore</artifactId>
                <groupId>eclipse</groupId>
            </exclusion>
        </exclusions>
    </dependency>

现在,如果 Web 应用程序中仍然需要 jdtcore 库(通常用于动态编译 jasper 报告),我们可以像这样添加范围为运行时的依赖项

    <dependency>
        <artifactId>jdtcore</artifactId>
        <groupId>eclipse</groupId>
        <version>3.1.0</version>
        <scope>runtime</scope>
    </dependency>

最后请注意,如果有人遇到问题,那么应该查看 pom.xml 中的任何依赖项是否对 jdtcore 有依赖性,排除它并将其作为运行时包含

希望对你有帮助

关于java.lang.NoSuchFieldError : reportUnusedDeclaredThrownExceptionIncludeDocCommentReference 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17991063/

相关文章:

java - 在 Spring Boot 应用程序中将 json 从 AngularJS 发送到 Spring Controller 时导致异常

php - HTML 和 PHP 输入 [] <- 数组 ?限制

Javascript:将 "this"作为 "dom"对象传递,而不是将 "this"作为 "this"函数传递

javascript - ion-header-bar 无法与侧菜单和幻灯片一起使用

delphi - 如何在 asm block 中引发异常?

java - 在java文件处理中使用 "throws IOException"

java - 从 Maven 文件夹结构的主/资源文件夹中选取文件时出现问题

java - 警报对话框中出现错误

java - 如何在 Eclipse 中打开这个 Spring 项目?

java - Android Espresso UI 测试 - 测试运行失败 : Instrumentation run failed due to 'java.lang.IllegalAccessError'