0
votes

To do some Surface-Tests I start an embedded Jetty for JUnit-Tests. My tests call some pages from the server. When doing this tests from eclipse everything works fine, the classpath is created by "mvn eclipse:eclipse".

When running those tests with "mvn test" the jsp-Compiler raises a lot of ClassNotFoundExceptions: javax.servlet., javax.servlet.jsp and evene some of my self generated classes. All requests directly answered by servlet work fine.

Doing in my testcases something like System.out.println(HttpServlet.class) works fine, too. So the Jetty-JSP compiler seems to habe some "specials" when compiling.

Anybody knows how to persuade Jetty to compile my JSPs?

3

3 Answers

0
votes

If you look pom of one jetty module you'll see:

<dependency>
    <groupId>org.eclipse.jetty.orbit</groupId>
    <artifactId>javax.servlet</artifactId>
    <scope>provided</scope>
</dependency>

It dependes on own servlet-api classes.

So maybe if you specify dependencies on real servlet-api in your project pom it will work:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.0.1</version>
</dependency>
0
votes

After all the problem seems to have been in mavens dependency-management (or what I allowed maven to do).

I had a real mess of javax-artifacts in my classpath (jsp-2.1, 2.2.3, 2.2.1, servlet 2.5, 3.0, 3.0.glassfish-style). So after I cleaned up dependencies everything works fine. Now I understand why jetty from maven-.build didnn't start. Finally I dont understand why at all jetty came up in eclipse ;)