我想以编程方式访问内容,我尝试了以下方法:
private Session getSession(String user, String passwort) {
Session session = null;
try {
Repository repository = JcrUtils.getRepository("http://localhost:4503/crx/server");
JcrUtils.getRepository("http://localhost:4503/crx/server");
session = repository.login(new SimpleCredentials(user, passwort.toCharArray()));
} catch (RepositoryException e) {
LOG.error(e.getMessage());
}
return session;
}
调用该getRepository
方法时出现以下异常:
javax.jcr.RepositoryException: Unable to access a repository with the following settings:
org.apache.jackrabbit.repository.uri: http://localhost:4503/crx/server
The following RepositoryFactory classes were consulted:
Perhaps the repository you are trying to access is not available at the moment.
我有版本cq5.4。任何想法?
PS:我尝试访问发布和作者实例并得到相同的异常。