I am trying to get a very simple demo of ModeShape up and running. I read the documentation on auth and understand that by default guest (anonymous) access is allowed. This is preferable to working with Jaas, at the moment. However I am unable to login to a new repository. Here is the code I am using (running against ModeShape 1.1.0-final):
JcrConfiguration config = new JcrConfiguration();
engine = config.build();
JcrRepository repo = engine.getRepository("configrepo");
System.out.println(JcrRepository.Option.ANONYMOUS_USER_ROLES + ": " + repo.getOptions().get(JcrRepository.Option.ANONYMOUS_USER_ROLES));
Session session = repo.login();
This results in the following output:
log4j:WARN No appenders could be found for logger (org.modeshape.graph.connector.RepositoryConnectionPool).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" javax.jcr.LoginException: login() can only be called successfully from within a java.security.PrivilegedAction or when the ANONYMOUS_USER_ROLES repository option is set
As you can see, the ANONYMOUS_USER_ROLES seems to be set correctly, yet the login fails. I also tried logging in with guest credentials (using both "guest" and "anonymous" as usernames with an email address as a password in a SimpleCredentials object) but that resulted in a different exception:
Exception in thread "main" java.lang.SecurityException: Unable to locate a login configuration
I have to assume I'm just making a very basic mistake here, but I haven't been able to figure out what that is yet. Any suggestions?