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

user1400290 picture user1400290 · Jun 24, 2015 · Viewed 8k times · Source

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

Answer

slawas picture slawas · Jun 24, 2015

I think that you must add dependency:

<dependency>
   <groupId>org.mortbay.jetty</groupId>
   <artifactId>jsp-2.1</artifactId>
   <version>6.1.14</version>
</dependency>

See http://mvnrepository.com/artifact/org.mortbay.jetty/jsp-2.1