2
我正在嘗試使用JAAS來認證我的用戶。我的項目在GWT v2中,運行碼頭。我使用eclipse進行開發。使用碼頭和gwt的jaas認證
從http://code.google.com/p/google-web-toolkit/issues/detail?id=4462我發現jetty不喜歡web.xml中的任何域定義,所以我將它們移到了jetty-web.xml。
我不斷收到ClassNotFound的異常,所以我也跟着這裏的建議是:communitymapbuilder.org/display/JETTY/Problems+with+JAAS+in+Jetty+6.0.0
不過,我仍然在獲得ClassNotFoundExceptionsHere我jetty-web.xml文件。如何配置jetty以在GWT項目中工作?
我的碼頭-web.xml文件:
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="serverClasses">
<Array type="java.lang.String">
<Item>-org.mortbay.jetty.plus.jaas.</Item>
<Item>org.mortbay.jetty</Item>
<Item>org.slf4j.</Item>
</Array>
</Set>
<Get name="securityHandler">
<Set name="userRealm">
<New class="org.mortbay.jetty.plus.jaas.JAASUserRealm">
<Set name="name">xyzrealm</Set>
<Set name="LoginModuleName">xyz</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/WEB-INF/classes/jdbcRealm.properties</Set>
</New>
</Set>
<Set name="authenticator">
<New class="org.mortbay.jetty.security.FormAuthenticator">
<Set name="loginPage">/login.jsp</Set>
<Set name="errorPage">/error.jsp</Set>
</New>
</Set>
</Get>
錯誤我收到:
[WARN] Failed startup of context com.g[email protected]1fcef4f7{/,/home/dev/workspace/project/war}
java.lang.ClassNotFoundException: org.mortbay.jetty.plus.jaas.JAASUserRealm
at java.lang.ClassLoader.findClass(ClassLoader.java:359)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
at org.mortbay.util.Loader.loadClass(Loader.java:91)
at org.mortbay.xml.XmlConfiguration.nodeClass(XmlConfiguration.java:216)
at org.mortbay.xml.XmlConfiguration.newObj(XmlConfiguration.java:564)
at org.mortbay.xml.XmlConfiguration.itemValue(XmlConfiguration.java:907)
at org.mortbay.xml.XmlConfiguration.value(XmlConfiguration.java:829)
at org.mortbay.xml.XmlConfiguration.set(XmlConfiguration.java:278)
at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:240)
at org.mortbay.xml.XmlConfiguration.get(XmlConfiguration.java:460)
at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:246)
at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:182)
at org.mortbay.jetty.webapp.JettyWebXmlConfiguration.configureWebApp(JettyWebXmlConfiguration.java:109)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1217)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:447)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:543)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:421)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1035)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:783)
at com.google.gwt.dev.DevMode.main(DevMode.java:275)