【问题标题】:Jackrabbit ignored CredentialsJackrabbit 忽略凭据
【发布时间】:2014-04-06 19:13:46
【问题描述】:

我正在尝试部署此示例

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

}

改编自https://jackrabbit.apache.org/

当我在 eclipse 上部署它时,出现以下错误和异常:

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

有人可以帮我解决这个问题吗?

提前致谢。

【问题讨论】:

    标签: credentials jackrabbit


    【解决方案1】:

    似乎有人在研究 Jackrabbit 的示例时已经遇到过您的问题。见answer on another SO question

    尝试用“admin”和“admin”替换“username”和“password”。

    【讨论】:

      猜你喜欢
      • 2022-06-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-16
      • 2021-11-21
      • 2016-08-03
      相关资源
      最近更新 更多