title: Jetty custom LoginService
body: <p>Can anyone point me to a working example of a custom LoginService for Jetty?</p>
  
  <p>I am just trying to do something as simple as making a copy of HashLoginService in a package in my project then reference that class from jetty-web.xml.  When I do so, I always get: </p>
  
  <pre><code>2017-05-23 21:16:36.511:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.w.WebAppContext@60c6f5b{/,file:///D:/jetty-distribution-9.4.2.v2
  0170220/webapps/a5-1.0-SNAPSHOT/,UNAVAILABLE}{D:\jetty-distribution-9.4.2.v20170220\webapps\a5-1.0-SNAPSHOT}
  java.lang.NoSuchMethodException: class org.eclipse.jetty.security.ConstraintSecurityHandler.setAuthenticator(class org.eclipse.jetty.security.authenti
  cation.FormAuthenticator)
          at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:593)
          at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:411)
          at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.get(XmlConfiguration.java:675)
          at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:420)
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>java.lang.NoSuchMethodException: class org.eclipse.jetty.security.ConstraintSecu
  rityHandler.setLoginService(class org.overlord.fta.login.MyLoginService)
          at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlC
  onfiguration.java:579)
          at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configur
  e(XmlConfiguration.java:384)
  </code></pre>
  
  <p>Is this some classloader issue that I'm not understanding?  Can anyone help me get a custom LoginService working?  Thanks so much!  </p>
  
  <p>I have tried the code at the following github project which is similar to my project setup but that doesn't work either (same errors). <a href="https://github.com/EricWittmann/fuse-test-apps/tree/master/fta-custom-login-service-war" rel="nofollow noreferrer">https://github.com/EricWittmann/fuse-test-apps/tree/master/fta-custom-login-service-war</a></p>
  
  <p>Below is my jetty-web.xml:</p>
  
  <pre><code>  &lt;Get name="securityHandler"&gt;
      &lt;Set name="loginService"&gt;
        &lt;!-- THIS WORKS USING JETTY'S HASHLOGINSERVICE --&gt;
        &lt;New class="org.eclipse.jetty.security.HashLoginService"&gt;
          &lt;Set name="name"&gt;testrealm&lt;/Set&gt;
          &lt;Set name="config"&gt;
          &lt;SystemProperty name="jetty.base"
                          default="." /&gt;/etc/realm.properties&lt;/Set&gt;
        &lt;/New&gt;   
        &lt;!-- THIS WON'T WORK USING MY HASHLOGINSERVICE --&gt;   
        &lt;!--New class="com.mysite.HashLoginService"&gt;
          &lt;Set name="name"&gt;testrealm&lt;/Set&gt;
          &lt;Set name="config"&gt;
          &lt;SystemProperty name="jetty.base"
                          default="." /&gt;/etc/realm.properties&lt;/Set&gt;
        &lt;/New--&gt;
    &lt;/Get&gt;
  </code></pre>