2014-03-04 6 views
2

이 나는 ​​일식에 배포 할 때잭 래빗 무시 자격 증명

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/

에서 적응이 예를 구축하기 위해 노력하고있어, 나는 오류 및 예외 다음 얻을 :

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 

수를 누군가이 문제를 도와 줘, 제발?

미리 감사드립니다.

답변

3

누군가가 이미 Jackrabbit의 예를 통해 문제를 경험 한 것 같습니다. answer on another SO question을 참조하십시오.

"username"및 "password"를 "admin"및 "admin"으로 바꾸십시오.

+0

감사합니다. – user3381124