javamavennoclassdeffounderrorjetty-8

Jetty: Java.lang.NoClassDefFoundError:org/apache/jasper/runtime/JspApplicationContextImpl error


I am using Jetty 8 (stable), JDK 1.7. Eclipse Luna latest.

I am new to using Jetty with Java, I am trying to run a sample code provided in Tutorial (Link to tutorial)

But I am getting following error:

2015-06-24 10:52:03.208:WARN:oejuc.AbstractLifeCycle:FAILED      
org.eclipse.jetty.server.handler.HandlerCollection@6be3fe1e: java.lang.NoClassDefFoundError:  org/apache/jasper/runtime/JspApplicationContextImpl Java.lang.NoClassDefFoundError:org/apache/jasper/runtime/JspApplicationContextImpl

I checked in my maven repository there this folder doesn't exists. I thought this folder will automatically create. But after running clean build several times I got the same error.

Do I need to create this folder manually then I should retry or it's due other reason. Please guide me in right direction.

Following is my pom.xml:

<properties>
<jetty-version>8.1.1.v20120215</jetty-version>
</properties>

<dependencies>
<dependency>
  <groupId>org.eclipse.jetty</groupId>
  <artifactId>jetty-server</artifactId>
  <version>${jetty-version}</version>
</dependency>
</dependencies>

<build>
<plugins>
  <plugin>
    <!-- This plugin is needed for the servlet example -->
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>${jetty-version}</version>
  </plugin>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.1</version>
    <executions>
      <execution><goals><goal>java</goal></goals></execution>
    </executions>
    <configuration>
      <mainClass>org.example.HelloWorld</mainClass>
    </configuration>
  </plugin>
</plugins>
</build>

Thanks


Solution

  • Actually, the default JRE version for my project was set to 1.5 but I was using JDK 1.7. Correcting this & updating the maven - Project-Update solved my problem. Also I have to stop all the servers that were running (Just to be safe).

    Thanks slawas for the help.