2017-05-24 1 views
0

JettyのカスタムLoginServiceの実際の例を教えてもらえますか?JettyカスタムLoginService

私はプロジェクト内のパッケージでHashLoginServiceのコピーを作成してからjetty-web.xmlからそのクラスを参照するだけの簡単なことをしようとしています。私がそうするとき、私は常に取得:

2017-05-23 21:16:36.511:WARN:oejw.WebAppContext:main: Failed startup of context [email protected]{/,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) 

OR

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) 

は、これは私が理解していないよ、いくつかのクラスローダの問題ですか?誰でも私はカスタムLoginServiceを働かせることができますか?本当にありがとう!

次のgithubプロジェクトでコードを試してみましたが、それは私のプロジェクトの設定と似ていますが、どちらも同じエラーはありません。 https://github.com/EricWittmann/fuse-test-apps/tree/master/fta-custom-login-service-war

以下は私の桟橋-web.xmlのである:この質問を越えつまずく人のために

<Get name="securityHandler"> 
    <Set name="loginService"> 
     <!-- THIS WORKS USING JETTY'S HASHLOGINSERVICE --> 
     <New class="org.eclipse.jetty.security.HashLoginService"> 
     <Set name="name">testrealm</Set> 
     <Set name="config"> 
     <SystemProperty name="jetty.base" 
         default="." />/etc/realm.properties</Set> 
     </New> 
     <!-- THIS WON'T WORK USING MY HASHLOGINSERVICE --> 
     <!--New class="com.mysite.HashLoginService"> 
     <Set name="name">testrealm</Set> 
     <Set name="config"> 
     <SystemProperty name="jetty.base" 
         default="." />/etc/realm.properties</Set> 
     </New--> 
    </Get> 

答えて