Configuring Jetty JSP support in embedded mode in Maven project

Ben McCann picture Ben McCann · Nov 20, 2010 · Viewed 34.9k times · Source

I can visit .html pages with Jetty, but when I visit a .jsp page I get:

0 13:21:13 / [INFO] No JSP support. Check that JSP jars are in lib/jsp and that the JSP option has been specified to start.jar

I added the following as dependencies:

<dependency>
  <groupId>org.eclipse.jetty</groupId>
  <artifactId>jetty-webapp</artifactId>
  <version>8.0.0.M1</version>
</dependency>
<dependency>
  <groupId>javax.servlet.jsp</groupId>
  <artifactId>jsp-api</artifactId>
  <version>2.1</version>
</dependency>

Does that fulfill the "check that JSP jars are in lib/jsp" part of the error message?

Also, I have no idea what "check that the JSP option has been specified to start.jar" means in this context. I have the following:

  public static void main(String[] args) throws Exception {
    Server server = new Server();

    SelectChannelConnector connector = new SelectChannelConnector();
    connector.setPort(8080);
    server.addConnector(connector);

    WebAppContext webApp = new WebAppContext();
    webApp.setContextPath("/");
    webApp.setWar("src/main/webapp");
    server.setHandler(webApp);
    server.start();
    server.join();
  }

Answer

Ben McCann picture Ben McCann · Nov 20, 2010

I got it to work by adding the Mortbay JSP dependency (this is in Gradle notation, but you get the idea):

compile 'org.eclipse.jetty:jetty-io:8.0.0.M3'
compile 'org.eclipse.jetty:jetty-server:8.0.0.M3'
compile 'org.eclipse.jetty:jetty-servlet:8.0.0.M3'
compile 'org.eclipse.jetty:jetty-util:8.0.0.M3'
compile 'org.eclipse.jetty:jetty-webapp:8.0.0.M3'
compile 'org.mortbay.jetty:jsp-2.1-glassfish:2.1.v20100127'

There's a larger writeup available on my blog.