8

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.

11 Answers 11

6

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>
1
  • Thanks @Jinferng. I had the same problem and solved it by removing anything referencing - org.mortbay.jetty - javax.servlet (old 2.x verions) - javax.servlet.jsp - tomcat inside <groupId>org.apache.hbase</groupId> <artifactId>hbase-rest</artifactId> <version>1.6.0</version> You can view all dependencies by issueing mvn dependency:tree
    – Pierre C
    Sep 4, 2020 at 18:55
4

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

3

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)
2

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

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

1

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

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
0

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.

0

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?'

0

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.

1
  • Actually project is developed by some one in his environment now the task came to me i dont know what versions of jars he used, then i took the code into eclipse then i got the same error, in that error msg we r able to c the some jasper compiler issues, then i added the following jar to the build path of project in eclipse those r ecj-4.4.2.jar,el-api.jar,jasper.jar,jasper-el.jar,jsp-api.jar,servlet-api.jar. then the issue is solved.
    – Satish
    Feb 4, 2016 at 9:10
0

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.