4

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

Vladimir Vagaytsev
  • 2,871
  • 9
  • 33
  • 36
user1400290
  • 1,682
  • 5
  • 23
  • 43

2 Answers2

3

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

slawas
  • 33
  • 3
  • But same code is working on another computer, even I tried this solution but I still got errors. – user1400290 Jun 24 '15 at 07:59
  • Have you same enviroment on both compiuters? Java, AppServer, Eclipse, and other? This library is needed in runtime. – slawas Jun 25 '15 at 09:34
0

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.

user1400290
  • 1,682
  • 5
  • 23
  • 43