title: Jetty 7 + MySQL Config [java.lang.ClassNotFoundException: org.mortbay.jetty.webapp.WebAppContext]
body: <p>I've been trying to get a c3p0 db connection pool configured for Jetty, but I keep getting a ClassNotFoundException:</p>
  
  <pre><code>2010-03-14 19:32:12.028:WARN::Failed startup of context WebAppContext@fccada@fccada/phpMyAdmin,file:/usr/local/jetty/webapps/phpMyAdmin/,file:/usr/local/jetty/webapps/phpMyAdmin/
  java.lang.ClassNotFoundException: org.mortbay.jetty.webapp.WebAppContext
      at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
      at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:313)
      at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:266)
      at org.eclipse.jetty.util.Loader.loadClass(Loader.java:90)
      at org.eclipse.jetty.xml.XmlConfiguration.nodeClass(XmlConfiguration.java:224)
      at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:187)
      at org.eclipse.jetty.webapp.JettyWebXmlConfiguration.configure(JettyWebXmlConfiguration.java:77)
      at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:975)
      at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:586)
      at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:349)
      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
      at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:165)
      at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:162)
      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
      at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:165)
      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
      at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:92)
      at org.eclipse.jetty.server.Server.doStart(Server.java:228)
      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
      at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:990)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:955)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.eclipse.jetty.start.Main.invokeMain(Main.java:394)
      at org.eclipse.jetty.start.Main.start(Main.java:546)
      at org.eclipse.jetty.start.Main.parseCommandLine(Main.java:208)
      at org.eclipse.jetty.start.Main.main(Main.java:75)
  </code></pre>
  
  <p>I'm new to Jetty and I want to ultimately get phpMyAdmin and WordPress to run on it through Quercus and a JDBC connection. Here are my web.xml and jetty-web.xml files in my WEB-INF directory.</p>
  
  <p>jetty-web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"&gt;
  &lt;Configure class="org.mortbay.jetty.webapp.WebAppContext"&gt;
      &lt;New id="mysql" class="org.mortbay.jetty.plus.naming.Resource"&gt;
          &lt;Arg&gt;jdbc/mysql&lt;/Arg&gt;
          &lt;Arg&gt;
              &lt;New class="com.mchange.v2.c3p0.ComboPooledDataSource"&gt;
                  &lt;Set name="Url"&gt;jdbc:mysql://localhost:3306/mysql&lt;/Set&gt;
                  &lt;Set name="User"&gt;user&lt;/Set&gt;
                  &lt;Set name="Password"&gt;pw&lt;/Set&gt;
              &lt;/New&gt;
          &lt;/Arg&gt;
      &lt;/New&gt;
  &lt;/Configure&gt;
  </code></pre>
  
  <p>web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"&gt;
  &lt;web-app&gt;
      &lt;description&gt;Caucho Technology's PHP Implementation&lt;/description&gt;
      &lt;resource-ref&gt;
          &lt;description&gt;My DataSource Reference&lt;/description&gt;
          &lt;res-ref-name&gt;jdbc/mysql&lt;/res-ref-name&gt;
          &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;
          &lt;res-auth&gt;Container&lt;/res-auth&gt;
      &lt;/resource-ref&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;Quercus Servlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;com.caucho.quercus.servlet.QuercusServlet&lt;/servlet-class&gt;
  
          &lt;!--
              Specifies the encoding Quercus should use to read in PHP scripts.
          --&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;script-encoding&lt;/param-name&gt;
              &lt;param-value&gt;UTF-8&lt;/param-value&gt;
          &lt;/init-param&gt;
  
          &lt;!--
              Tells Quercus to use the following JDBC database and to ignore the
              arguments of mysql_connect().
          --&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;database&lt;/param-name&gt;
              &lt;param-value&gt;jdbc/mysql&lt;/param-value&gt;
          &lt;/init-param&gt;
  
          &lt;init-param&gt;
              &lt;param-name&gt;ini-file&lt;/param-name&gt;
              &lt;param-value&gt;WEB-INF/php.ini&lt;/param-value&gt;
          &lt;/init-param&gt;
  
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;Quercus Servlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.php&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;index.php&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>I'm guessing that I'm missing a few jars or something. Currently I have placed the following jars in my WEB-INF/lib directory:</p>
  
  <blockquote>
    <p>c3p0-0.9.1.2.jar<br>
    commons-dbcp-1.4.jar<br>
    commons-pool-1.5.4.jar<br>
    mysql-connector-java-5.1.12-bin.jar</p>
  </blockquote>
  
  <p>I have also tried to put these jars in JETTY-HOME/lib/ext, but to no avail... Someone please tell me what is wrong with my configuration. I'm sick of digging through Jetty's crappy documentation.</p>