diambakus
diambakus

Reputation: 95

Jackrabbit ignored Credentials

I'm trying to deploy this example

import javax.jcr.Repository; 
import javax.jcr.Session; 
import javax.jcr.SimpleCredentials; 
import javax.jcr.Node; 
import org.apache.jackrabbit.core.TransientRepository; 

/** 
 * Second hop example. Stores, retrieves, and removes example content. 
 */ 
public class Fish {

static Repository repository;

public static void main(String[] args) {

    Session session = null;
    try {
        repository = getRepositoryHandle();
        SimpleCredentials simpleCredentials = new SimpleCredentials(
                "username", "password".toCharArray());

        session = repository.login(simpleCredentials);

        Node root = session.getRootNode();
        Node hello = root.addNode("Olá");
        Node world = hello.addNode("Mundo");
        world.setProperty("Message", "olá mundo");
        session.save();

        Node node = root.getNode("Olá/Mundo");
        System.out.println(node.getPath());
        System.out.println(node.getProperty("Message").toString());

        root.getNode("Olá").remove();
        session.save();
    } catch (Exception e) {
        throw new RuntimeException(e);
    } finally {
        if (session != null)
            session.logout();
    }
}

private static Repository getRepositoryHandle() {
    if (repository == null)
        repository = new TransientRepository();
    // "classpath:repository.xml", "target/repository");
    return repository;
}

}

adapted from https://jackrabbit.apache.org/

When I deploy it on eclipse, I get following errors and exceptions:

Exception in thread "main" java.lang.RuntimeException: javax.jcr.LoginException: LoginModule ignored Credentials
    at recipe.Fish.main(Fish.java:38)
Caused by: javax.jcr.LoginException: LoginModule ignored Credentials
    at org.apache.jackrabbit.core.RepositoryImpl.login(RepositoryImpl.java:1526)
    at org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:381)
    at org.apache.jackrabbit.commons.AbstractRepository.login(AbstractRepository.java:144)
    at recipe.Fish.main(Fish.java:22)
Caused by: javax.security.auth.login.FailedLoginException: LoginModule ignored Credentials
    at org.apache.jackrabbit.core.security.authentication.LocalAuthContext.login(LocalAuthContext.java:87)
    at org.apache.jackrabbit.core.RepositoryImpl.login(RepositoryImpl.java:1498)
    ... 3 more

Can someone help me with this issue, please ?

Thanks in advance.

Upvotes: 2

Views: 2831

Answers (1)

Markus
Markus

Reputation: 452

Seems like someone already experienced your problem when working through Jackrabbit's examples. See answer on another SO question.

Try replacing "username" and "password" by "admin" and "admin".

Upvotes: 4

Related Questions