I am trying to define a security realm for jetty under hosted mode,
but get the following:

00:10:38.130 [WARN] Configuration problem at <login-config> <auth-
method>BASIC</auth-method> <realm-name>genomix</realm-name> </login-
config>

java.lang.NullPointerException
        at
org.mortbay.jetty.webapp.WebXmlConfiguration.initLoginConfig(WebXmlConfiguration.java:
883)
        at
org.mortbay.jetty.webapp.WebXmlConfiguration.initWebXmlElement(WebXmlConfiguration.java:
359)
        at
org.mortbay.jetty.webapp.WebXmlConfiguration.initialize(WebXmlConfiguration.java:
289)
        at
org.mortbay.jetty.webapp.WebXmlConfiguration.configure(WebXmlConfiguration.java:
222)
        at com.google.gwt.dev.ServletValidator.create(ServletValidator.java:
69)
        at com.google.gwt.dev.ServletValidator.create(ServletValidator.java:
52)
        at com.google.gwt.dev.DevMode.doSlowStartup(DevMode.java:356)
        at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1057)
        at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:783)
        at com.google.gwt.dev.DevMode.main(DevMode.java:275)

My jetty-web.xml has:

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd";>

<Configure class="org.mortbay.jetty.webapp.WebAppContext">

        <Get name="SecurityHandler">
                <Set name="UserRealm">
                        <New class="org.mortbay.jetty.security.HashUserRealm">
                                <Set name="name">genomix</Set>
                                <Set name="config"><SystemProperty 
name="user.home"/>/Properties/
genomix.realm.properties</Set>
                        </New>
                </Set>
        </Get>

</Configure>


The web.xml has the usual security stuff:

<web-app>
...
        <security-constraint>
                <web-resource-collection>
                        <web-resource-name>Everything</web-resource-name>
                        <url-pattern>/*</url-pattern>
                </web-resource-collection>
                <auth-constraint>
                        <role-name>user</role-name>
                </auth-constraint>
        </security-constraint>

        <security-role>
                <role-name>user</role-name>
        </security-role>

        <login-config>
                <auth-method>BASIC</auth-method>
                <realm-name>genomix</realm-name>
        </login-config>
</web-app>


The exception happens in "initLoginConfig" on the line:

        UserRealm[]
realms=ContextHandler.getCurrentContext().getContextHandler().getServer().getUserRealms();

and results because ContextHandler.getCurrentContext() returns null.

When dev mode is started this method is called twice, and the
exception happens on the second call. For the first call this method
does not throw an exception, but "realms" is empty, and an "Unknown
realm" warning is logged.

It looks like maybe I am supposed to define the realm in jetty.xml,
but it is not clear to me how this would be done for the instance of
jetty launched by GWT.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to