title: How to persist sessions with Jetty 7 and jetty-maven-plugin?
body: <p>I'd like to configure Jetty to persist sessions on disk, so that restarting Jetty would not lose the sessions, but by reading the documentation I haven't yet got it working. </p>
  
  <p>I'm running Jetty using <a href="http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin" rel="nofollow">Jetty Maven plugin</a> (<code>org.mortbay.jetty:jetty-maven-plugin 7.4.3.v20110701</code>).</p>
  
  <p><a href="http://wiki.eclipse.org/Jetty/Howto/Persisting_Sessions" rel="nofollow">Enabling Persistence for the Maven Jetty Plugin</a> tells to set up the <code>HashSessionManager</code> in the <code>sessionHandler</code> configuration section of the plugin, but the example there seems to be for the old <code>maven-jetty-plugin</code>, not the new <code>jetty-maven-plugin</code>. </p>
  
  <p>I tried fixing the class names there like this (I also had to add a dependency to jetty-server jar, otherwise I got ClassNotFoundExceptions):</p>
  
  <pre><code>&lt;webAppConfig implementation="org.mortbay.jetty.plugin.JettyWebAppContext"&gt;
      &lt;defaultsDescriptor&gt;${project.build.outputDirectory}/META-INF/webdefault.xml&lt;/defaultsDescriptor&gt;
      &lt;contextPath&gt;${jetty.contextRoot}&lt;/contextPath&gt;
      &lt;sessionHandler implementation="org.eclipse.jetty.server.session.SessionHandler"&gt;
          &lt;sessionManager implementation="org.eclipse.jetty.server.session.HashSessionManager"&gt;
              &lt;storeDirectory&gt;${basedir}/target/jetty-sessions&lt;/storeDirectory&gt;
          &lt;/sessionManager&gt;
      &lt;/sessionHandler&gt;
  &lt;/webAppConfig&gt;
  </code></pre>
  
  <p>Directory target/jetty-sessions gets created when server is run, but nothing is written there and the sessions don't persist as far as I can tell.</p>
  
  <p>So, what am I missing?</p>