我是JackRabbit的新手,我正在尝试运行FirstHop.java但是我遇到了以下错误。
码
import javax.jcr.Repository;
import javax.jcr.Session;
import org.apache.jackrabbit.core.TransientRepository;
public class FirstHop {
public static void main(String[] args) throws Exception
{
Repository repository = (Repository) new TransientRepository();
Session session = repository.login();
try
{
String user = session.getUserID();
String name = repository.getDescriptor(Repository.REP_NAME_DESC);
System.out.println(
"Logged in as " + user + " to a " + name + " repository.");
}
finally
{
session.logout();
}
}
}
log4j:WARN No appenders could be found for logger (org.apache.jackrabbit.core.TransientRepository).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.jackrabbit.spi.Path.resolve(Lorg/apache/jackrabbit/spi/Path$Element;)Lorg/apache/jackrabbit/spi/Path;
at org.apache.jackrabbit.core.version.InternalVersionManagerImpl.<clinit>(InternalVersionManagerImpl.java:86)
at org.apache.jackrabbit.core.RepositoryImpl.createVersionManager(RepositoryImpl.java:492)
at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:311)
at org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:589)
at org.apache.jackrabbit.core.TransientRepository$2.getRepository(TransientRepository.java:232)
at org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:280)
at org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:376)
at org.apache.jackrabbit.commons.AbstractRepository.login(AbstractRepository.java:111)
at com.ksh.FirstHop.main(FirstHop.java:23)
我正在使用以下罐子。
感谢。
答案 0 :(得分:0)
你需要Jackrabbit-Standalone罐子。由于多个罐中存在相同的类定义,因此会发生多个冲突。此外,在使用Jackrabbit时,由于许多功能已从1.5更改为2.4,因此不建议使用版本不匹配。
我只用jackrabbit-Standalone jar运行相同的程序。