tags:

views:

269

answers:

1

Hello, I am trying to use JAAS to authenticate my users. My project is in GWT v2, which runs jetty. I use eclipse for development.

From http://code.google.com/p/google-web-toolkit/issues/detail?id=4462 I found out that jetty doesn't like any realm definitions in web.xml, so I moved them to jetty-web.xml.

I keep getting ClassNotFound exceptions so I followed the advice here: communitymapbuilder.org/display/JETTY/Problems+with+JAAS+in+Jetty+6.0.0

However, I am still getting ClassNotFoundExceptionsHere in my jetty-web.xml file. How do I configure jetty to work jaas in GWT projects?

My jetty-web.xml file:

<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>

Error I am receiving:

[WARN] Failed startup of context com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload@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)
A: 

Apparently you need to include the optional 'plus' jar from the jetty's /lib distribution for jaas to work. That made the classnotfound exception go away.

dubreakkk