简体   繁体   English

Eclipse JDT 核心 Java 运行时错误 - java.lang.NoSuchMethodError

[英]Eclipse JDT core Java runtime error - java.lang.NoSuchMethodError

I could not find any helping document regarding this error hence I am posting this question.我找不到有关此错误的任何帮助文档,因此我发布了此问题。

I am trying to use locally built Eclipse JDT core jar in my project.我正在尝试在我的项目中使用本地构建的 Eclipse JDT 核心 jar。 I followed the flowing steps.我跟着流动的步骤。

  1. Created an eclipse workspace as described in Link链接中所述,创建了 eclipse 工作区
  2. Built eclipse.jdt.core using the mvn -P build-individual-bundles package使用mvn -P build-individual-bundles package eclipse.jdt.core
  3. Added the resulting jar file that is created in the target folder to my project (ie, project A ) as a maven dependency.将在target文件夹中创建的生成jar文件添加到我的项目(即project A )作为 maven 依赖项。

After the above steps, I could successfully compile project A and now it gives me the following runtime error.经过上述步骤,我可以成功编译项目 A,现在它给了我以下运行时错误。

Exception in thread "pool-2-thread-1" java.lang.NoSuchMethodError: org.eclipse.core.runtime.SubMonitor.split(I)Lorg/eclipse/core/runtime/SubMonitor;
    at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:820)
    at utils.JavaASTUtil.parseSource(JavaASTUtil.java:87)
    at change.CFile.<init>(CFile.java:32)
    at change.RevisionAnalyzer.buildGitModifiedFiles(RevisionAnalyzer.java:310)
    at change.RevisionAnalyzer.analyzeGit(RevisionAnalyzer.java:130)
    at change.ChangeAnalyzer.analyzeGit(ChangeAnalyzer.java:243)
    at change.ChangeAnalyzer.analyzeGit(ChangeAnalyzer.java:228)
    at main.MainChangeAnalyzer$2.run(MainChangeAnalyzer.java:99)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)

pom.xml of the project is given below项目的pom.xml如下

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>AtomicASTChangeMining</groupId>
    <artifactId>AtomicASTChangeMining</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <repositories>
        <repository>
            <id>local-maven-repo</id>
            <url>file:///Users/xx/Documents/Research_Topic_2/</url>
        </repository>
    </repositories>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <!--Below is the locally built jdt core jar -->
        <dependency>
            <groupId>org.eclipse.jdt</groupId>
            <artifactId>org.eclipse.jdt.core</artifactId>
            <version>3.23.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.core</groupId>
            <artifactId>runtime</artifactId>
            <version>3.10.0-v20140318-2214</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.birt.runtime</groupId>
            <artifactId>org.eclipse.core.resources</artifactId>
            <version>3.10.0.v20150423-0755</version>
        </dependency>

        <dependency>
            <groupId>org.eclipse</groupId>
            <artifactId>osgi</artifactId>
            <version>3.10.0-v20140606-1445</version>
        </dependency>


    </dependencies>
</project>

Does anybody have any idea about the runtime error?有人对运行时错误有任何想法吗? Thanks a lot!非常感谢!

org.eclipse.core.runtime.SubMonitor is actually in the org.eclipse.equinox.common plug-in. org.eclipse.core.runtime.SubMonitor实际上是在org.eclipse.equinox.common插件中。

According to the Javadoc the split methods were added to SubMonitor in version 3.8 of org.eclipse.equinox.common.根据 Javadoc, split方法在 org.eclipse.equinox.common 的 3.8 版中添加到SubMonitor This corresponds to Eclipse release 4.6.这对应于 Eclipse 版本 4.6。

Do experiments on org.eclipse.core version.在 org.eclipse.core 版本上做实验。 You might need to upgrade the version of org.eclipse.birt.runtime .您可能需要升级org.eclipse.birt.runtime的版本。 Select the version that contains the method SubMonitor.split(). Select 包含方法 SubMonitor.split() 的版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM