Eclipse JDT core Java runtime error - java.lang.NoSuchMethodError

Viewed 580

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. I followed the flowing steps.

  1. Created an eclipse workspace as described in Link
  2. Built eclipse.jdt.core using the mvn -P build-individual-bundles package
  3. Added the resulting jar file that is created in the target folder to my project (i.e., project A) as a maven dependency.

After the above steps, I could successfully compile project A and now it gives me the following runtime error.

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

<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!

2 Answers

org.eclipse.core.runtime.SubMonitor is actually in the org.eclipse.equinox.common plug-in.

According to the Javadoc the split methods were added to SubMonitor in version 3.8 of org.eclipse.equinox.common. This corresponds to Eclipse release 4.6.

Do experiments on org.eclipse.core version. You might need to upgrade the version of org.eclipse.birt.runtime. Select the version that contains the method SubMonitor.split().

Related