title: Jetty and SQLite connection in servlets
body: <p>I'm making a small servlet app in Java, with Maven, in Netbeans. I'm using SQLite database, and newest Jetty server. I have problem with creating connection pool for use in servlets. What works(in servlet):</p>
  
  <pre><code>Class.forName("org.sqlite.JDBC");
  String url = "jdbc:sqlite:c:\\db\\base";
  Connection con = DriverManager.getConnection(url);
  </code></pre>
  
  <p>And this works without specific settings in jetty.xml/web.xml/pom.xml
  I have libraries to use SQLite and connection pools (org.xerial.sqlite-jdbc, commons-pool, commons-dbcp).</p>
  
  <p>What doesn't work:</p>
  
  <p>web.xml:</p>
  
  <pre><code>    &lt;resource-ref&gt;
         &lt;description&gt;DB Connection Pool&lt;/description&gt;
         &lt;res-ref-name&gt;jdbc/DSTestPool&lt;/res-ref-name&gt;
         &lt;res-type&gt;javax.sql.ConnectionPoolDataSource&lt;/res-type&gt;
         &lt;res-auth&gt;Container&lt;/res-auth&gt;
      &lt;/resource-ref&gt;
  </code></pre>
  
  <p>jetty.xml</p>
  
  <pre><code>&lt;New id="DSTestPool" class="org.eclipse.jetty.plus.jndi.Resource"&gt;
      &lt;Arg&gt;jdbc/DSTestPool&lt;/Arg&gt;
      &lt;Arg&gt;
          &lt;New class="org.sqlite.SQLiteConnectionPoolDataSource"&gt;
              &lt;Set name="driverClassName"&gt;org.sqlite.JDBC&lt;/Set&gt;
              &lt;Set name="url"&gt;jdbc:sqlite:c:\\db\\base&lt;/Set&gt;         
          &lt;/New&gt;
      &lt;/Arg&gt;
  &lt;/New&gt;
  </code></pre>
  
  <p>pom.xml - dependencies.</p>
  
  <p>This configuration, even without changes in code (change to using pool) creates error in jetty console:
  <code>java.lang.reflect.InvocationTargetException
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  ....
  Caused by:
     java.lang.IllegalStateException: Nothing to bind for name jdbc/DSTestPool at org.eclipse.jetty.plus.webapp.PlusDescriptorProcessor.bindEntry(PlusDescriptorProcessor.java:895)
  ...</code></p>
  
  <p>Opening app in Jetty: Error 503</p>
  
  <p>I think there is something wrong with my declaration of jdbc/DSTestPool in jetty.xml, I've tried different parameters, but result was the same.</p>