Ok, I know I'm probably doing something stupid here but I can't find any decent tutorials that actually specify what specifically to do other than "Just create a jaas.config file and put in your project".

I am currently extending the SimpleWebdavServlet like so:
public Repository getRepository() {
        if (repository == null) {
            try {
                repository = createNewRepository();
            } catch (NamingException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
            } catch (RepositoryException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
            }
        }
        return repository;
    }

private Repository createNewRepository() throws NamingException, RepositoryException {
        String configFile = "repository.xml";
        String repHomeDir = "/Users/warnero/test-repo";

        Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.jackrabbit.core.jndi"
            + ".provider.DummyInitialContextFactory");
        env.put(Context.PROVIDER_URL, "localhost");
        InitialContext ctx = new InitialContext(env);

RegistryHelper.registerRepository(ctx, "repo", configFile, repHomeDir, true);
        return (Repository)ctx.lookup("repo");

    }

When I attempt to hit the repository at
localhost:8080/webdav-spike/repository

The servlet comes up with the authentication response, but if I just hit Ok then I get this error:
java.lang.NullPointerException
org .apache .jackrabbit .server.SessionProviderImpl.getSession(SessionProviderImpl.java:55) org .apache .jackrabbit .webdav .simple .DavSessionProviderImpl.attachSession(DavSessionProviderImpl.java:85) org .apache .jackrabbit .webdav .server.AbstractWebdavServlet.service(AbstractWebdavServlet.java:182)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

I have a jaas.config file located in my web directory (both WEB-INF and classes) :
Jackrabbit {
org.apache.jackrabbit.core.security.SimpleLoginModule required anonymousId="anonymous";
};

And this is also setup in my repository.xml file

<Security appName="Jackrabbit">
        <!--
            access manager:
class: FQN of class implementing the AccessManager interface
        -->
<AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager"> <!-- <param name="config" value="${rep.home}/access.xml"/ > -->
        </AccessManager>

<LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule"> <!-- anonymous user name ('anonymous' is the default value) -->
           <param name="anonymousId" value="anonymous"/>
        </LoginModule>
    </Security>

All of this is fairly straightforward from the Web site, I can't seem to find in the jackrabbit-webapp an actual jaas.config file in the war, so I'm not sure what I need to do to set this up properly.

Thanks in advance!

-warner

Reply via email to