title: How do I enable JSP support in Jetty 8 on Debian Wheezy?
body: <p>I have a Debian Wheezy server and I'd like to use Jetty to deploy Java web applications as .war files. I'm attempting to configure Jetty to properly display a basic jsp page so that I can assume I have a working Jetty server configuration before getting too far. However, I'm having some issues configuring JSP support and not much luck finding Debian-specific documentation.</p>
  
  <p>I've installed Jetty 8 via the <code>jetty8</code> and <code>libjetty8-java</code> packages and created an application via IntelliJ IDEA; the resulting .war contains just an index.jsp and a WEB-INF/web.xml file. The web.xml file contains this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns="http://java.sun.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
               http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
           version="3.0"&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>The index.jsp file contains this:</p>
  
  <pre><code>&lt;%@ page contentType="text/html;charset=UTF-8" language="java" %&gt;
  &lt;html&gt;
    &lt;head&gt;&lt;title&gt;Test&lt;/title&gt;&lt;/head&gt;
    &lt;body&gt;Test&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Nothing too fancy there. I then enabled JSP support in Jetty by changing <code>JETTY_ARGS</code> in <code>/etc/default/jetty8</code> to <code>OPTIONS=default,jsp</code>, placed the .war in <code>$JETTY_HOME/webapps</code>, and restarted the Jetty server.</p>
  
  <p>Attempting to load the page failed and left this error in the logs:</p>
  
  <pre><code>2013-03-22 22:39:38.914:INFO:oejs.Server:jetty-8.1.3.v20120416
  2013-03-22 22:39:39.034:WARN:oejw.WebAppContext:Failed startup of context o.e.j.w.WebAppContext{,file:/var    /lib/jetty8/webapps/root/},file:/var/lib/jetty8/webapps/root/
  java.lang.reflect.InvocationTargetException
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  [...snip...]
          at org.eclipse.jetty.start.Main.invokeMain(Main.java:457)
          at org.eclipse.jetty.start.Main.start(Main.java:602)
          at org.eclipse.jetty.start.Main.main(Main.java:82)
  Caused by:
  java.lang.NoClassDefFoundError: org/apache/tomcat/PeriodicEventListener
          at java.lang.ClassLoader.defineClass1(Native Method)
          at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
  [...snip...]
          at org.eclipse.jetty.start.Main.start(Main.java:602)
          at org.eclipse.jetty.start.Main.main(Main.java:82)
  </code></pre>
  
  <p>This led me to include <code>tomcat-api.jar</code> in <code>$JETTY_HOME/lib/ext</code>, which then led me to include <code>tomcat-juli.jar</code> (to correct a NoClassDefFoundError for <code>org.apache.juli.logging.LogFactory</code>), and finally <code>tomcat-jasper-el.jar</code> (to correct a NoClassDefFoundError for <code>org.apache.el.ExpressionFactoryImpl</code>).</p>
  
  <p>My current JSP-related jars in my classpath look like this:</p>
  
  <pre><code>/usr/share/jetty8/lib$ ls -l jsp
  total 0
  lrwxrwxrwx 1 root root 28 Jun 25  2012 javax.el.jar -&gt; ../../../java/el-api-2.2.jar
  lrwxrwxrwx 1 root root 29 Jun 25  2012 javax.servlet.jsp.jar -&gt; ../../../java/jsp-api-2.2.jar
  lrwxrwxrwx 1 root root 25 Jun 25  2012 javax.servlet.jsp.jstl.jar -&gt; ../../../java/jstl1.1.jar
  lrwxrwxrwx 1 root root 31 Jun 25  2012 org.apache.jasper.jar -&gt; ../../../java/tomcat-jasper.jar
  lrwxrwxrwx 1 root root 26 Jun 25  2012 org.apache.taglibs.standard.jar -&gt; ../../../java/standard.jar
  /usr/share/jetty8/lib$ ls -l ext
  total 0
  lrwxrwxrwx 1 root root 28 Mar 23 09:59 tomcat-api.jar -&gt; ../../../java/tomcat-api.jar
  lrwxrwxrwx 1 root root 34 Mar 23 09:45 tomcat-jasper-el.jar -&gt; ../../../java/tomcat-jasper-el.jar
  lrwxrwxrwx 1 root root 29 Mar 23 09:43 tomcat-juli.jar -&gt; ../../../java/tomcat-juli.jar
  </code></pre>
  
  <p>The jars in the <code>jsp</code> directory are those provided by the default Jetty install, while I have added mine to <code>ext</code>.</p>
  
  <p>My current error is this:</p>
  
  <pre><code>java.lang.IllegalStateException: No org.apache.tomcat.InstanceManager set in ServletContext
          at org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(InstanceManagerFactory.java:35)
          at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:171)
          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
          at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598)
  [...snip...]
          at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)
          at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
          at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
          at java.lang.Thread.run(Thread.java:679)
  </code></pre>
  
  <p>Based on research, it seems like this could occur if I included tomcat libraries in my .war, but I don't. I'm not entirely sure where to proceed from here, and I'm not having any luck finding documentation covering this.</p>
  
  <p>Has anyone had success taking Jetty 8 in Debian Wheezy and enabling JSP or have any ideas where I may have gone wrong with attempting to?</p>