naveen kumar
naveen kumar

Reputation: 151

java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.CompilationResult

I have created a web service in netbeans 6.7 and one project for client. The web service has a method which does some query from database and returns me an array. Calling the web service method in client.jsp file in web clients service gives error :

javax.servlet.ServletException: java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/IProblem;
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:273)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

root cause

java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/IProblem;
    org.apache.jasper.compiler.JDTCompiler$2.acceptResult(JDTCompiler.java:354)
    org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:398)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:425)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
`

I have imported jars from hadoop.

Upvotes: 8

Views: 31858

Answers (11)

rogerdpack
rogerdpack

Reputation: 66711

In my case appears I had "jdtcore" dependency being pulled in by one thing (jasperreports), and ecj dependency being pulled in by another (drools). Conflict, as mentioned by Tim's answer!

Fix was figure out which two dependencies were pulling it in, then either update jasperreports, so it no longer had the jdtcore dependency, or exclude jdtcore dependency from the jasperreports' dependency in the pom file. Here's the exclude:

<dependency>
  <groupId>net.sf.jasperreports</groupId>
  <version>4.5.1</version>
  <artifactId>jasperreports</artifactId>
  <exclusions>
    <exclusion>
     <!-- conflict with newer drools knowledge-api's ecj  -->
      <groupId>eclipse</groupId>
      <artifactId>jdtcore</artifactId>
    </exclusion>
  </exclusions>
</dependency>

Seems to fix:

Attempt to fix sdb dying at startup, with our new drools'ish jar:

Caused by: java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
        at org.drools.commons.jci.compilers.EclipseJavaCompiler$3.acceptResult(EclipseJavaCompiler.java:328)
        at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:411)

Upvotes: 0

Deepak Maurya
Deepak Maurya

Reputation: 11

I also had the similar problem and all these answers were not solving my problem. I was using drools in spark and implemented my code using java. I got the same error on cluster (On local system in eclipse it was working fine), the cause for this problem was ecj-x.x.x.jar file. On cluster some other version of jar file was present which was creating the compilation problem for drool file (.drl file). So in driver classpath I externally added the current version of ecj jar file and it worked for me.

Command which I used during spark-submit:

spark2-submit --driver-class-path ecj-4.4.2.jar --class Yourclass Yourbundeledjarfile.jar

Upvotes: 1

ankit.vishen
ankit.vishen

Reputation: 1170

In my case it was because of conflict of dependency jar but its tough to find out which jar is the cause of conflict.

So to check conflict, in pom.xml there is Dependency Hierarchy tab in eclipse. In Resolved Dependency section check whether there are two jars with same name. If found then exclude one of them from parent dependency.

enter image description here

In my case it was jsp-api jar, By clicking on jsp-api jar I found that parent dependency is activemq-core so I excluded jsp-api jar from activemq-core dependency and its working fine.

<dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>activemq-core</artifactId>
    <version>5.6.0</version>
    <exclusions>
        <exclusion>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jsp-2.1</artifactId>
         </exclusion>
        <exclusion>
             <groupId>org.mortbay.jetty</groupId>
             <artifactId>jsp-api-2.1</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Upvotes: 1

Satish
Satish

Reputation: 49

HI this is because of jsp page compilers, In my case the jsp pages is developed in older version of tomcat then i deployed into new version of tomcat then i got java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/IProblem; then i added the 'jasper-.' and 'ecj.,el-.*'jars to the build path. I succeeded.

Upvotes: 0

blamblambunny
blamblambunny

Reputation: 755

I fixed this by using the correct Servlet API version: Tomcat 7.x expects version 3.0.x, not the 3.1.x I'd tried using. See also 'What does offending class tell me on server startup?'

Upvotes: 0

Peter Tadros
Peter Tadros

Reputation: 9297

I excluded the following dependencies from "org.apache.hbase" in the pom.xml file

<exclusion>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty</artifactId>
</exclusion>
<exclusion>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-util</artifactId>
 </exclusion>
 <exclusion>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jsp-2.1</artifactId>
 </exclusion>
<exclusion>
     <groupId>org.mortbay.jetty</groupId>
     <artifactId>jsp-api-2.1</artifactId>
</exclusion>
<exclusion>
     <groupId>org.mortbay.jetty</groupId>
     <artifactId>servlet-api-2.1</artifactId>
</exclusion>
<exclusion>
    <groupId>tomcat</groupId>
    <artifactId>jasper-compiler</artifactId>
</exclusion>
<exclusion>
    <groupId>tomcat</groupId>
    <artifactId>jasper-runtime</artifactId>
</exclusion>

This solved my problem

Upvotes: 1

mukut
mukut

Reputation: 130

I started working on hadoop and wanted to integrate to be put in hadoop from app. SO added hadoop maven dependency and all these errors thrown by app. Once I removed my hadoop dependency then errors gone.

Upvotes: 0

Jinfeng
Jinfeng

Reputation: 99

I met the same exception with you. In my cases, it's caused by the jetty library conflicts with Hadoop/HBase libraries( maybe both contain org.eclipse.jdt.internal.compiler.CompilationResult method). I solve this bug by adding following exclusions into Hadoop/HBase dependencies:

      <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-common</artifactId>
      <version>${hadoop.version2}</version>
      <exclusions>
        <exclusion>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-util</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jsp-2.1</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jsp-api-2.1</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>servlet-api-2.1</artifactId>
        </exclusion>
        <exclusion>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
        </exclusion>
        <exclusion>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
        </exclusion>
        <exclusion>
            <groupId>tomcat</groupId>
            <artifactId>jasper-compiler</artifactId>
        </exclusion>
        <exclusion>
            <groupId>tomcat</groupId>
            <artifactId>jasper-runtime</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

Upvotes: 6

Daniel Cerecedo
Daniel Cerecedo

Reputation: 6207

I had the same problem with jars from hadoop that in turn depend on some jetty packages. I solved it by placing the following exclusions in the offending dependency:

<exclusions>
  <exclusion>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>servlet-api</artifactId>
  </exclusion>
  <exclusion>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>servlet-api-2.5</artifactId>
  </exclusion>
  <exclusion>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jsp-2.1</artifactId>
  </exclusion>
  <exclusion>
    <groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-api-2.1</artifactId>
  </exclusion>
</exclusions>

Upvotes: 2

thiru_k
thiru_k

Reputation: 847

try running by removing ecj-x.x.x.jar from your tomcat library

Upvotes: 4

Tim Boudreau
Tim Boudreau

Reputation: 1781

You have multiple versions of the library containing org.eclipse.jdt.internal.compiler.CompilationResult on your classpath, and they are ordered so that a version in which the method CompilationResult.getProblems() does not exist (or was incompatibly changed) comes first on the classpath, probably because it is provided by whatever container you're running in.

Possible solutions:

  • Reorder the classpath to avoid the problem
  • If it is a Maven project, exclude the duplicate JARs as dependencies (in NetBeans, expand the Libraries node and right click the library and choose Exclude Dependency from the popup menu)

Upvotes: 4

Related Questions