Expand my Community achievements bar.

SOLVED

AEM 6.1 Programmatically accessing cq content using JCR API : Exception in "main" thread java.lang.NoSuchMethodError. HELP REQUIRED

Avatar

Former Community Member

I am using AEM 6.1. I tried the sample code from the below link,

https://helpx.adobe.com/experience-manager/using/programmatically-accessing-cq-content-using.html

I have got the Repository Object and Session Object (ie., have successfully connected to the repository). But then, I get the below exception at session.getRootNode().

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.jackrabbit.spi.RepositoryService.getItemInfos(Lorg/apache/jackrabbit/spi/SessionInfo;Lorg/apache/jackrabbit/spi/ItemId;)Ljava/util/Iterator;

Full Stack Trace :

repository = org.apache.jackrabbit.jcr2spi.RepositoryImpl@4570415f
session = org.apache.jackrabbit.jcr2spi.SessionImpl@61dd6a83
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/workspace/AEM/AEMExcelCustomJars/slf4j-nop-1.7.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/workspace/AEM/JackrabbitBundle/jackrabbit-standalone-2.10.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.helpers.NOPLoggerFactory]
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.jackrabbit.spi.RepositoryService.getItemInfos(Lorg/apache/jackrabbit/spi/SessionInfo;Lorg/apache/jackrabbit/spi/ItemId;)Ljava/util/Iterator;
at org.apache.jackrabbit.jcr2spi.state.WorkspaceItemStateFactory.createNodeState(WorkspaceItemStateFactory.java:93)
at org.apache.jackrabbit.jcr2spi.state.TransientISFactory.createNodeState(TransientISFactory.java:97)
at org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntryImpl.doResolve(NodeEntryImpl.java:990)
at org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntryImpl.resolve(HierarchyEntryImpl.java:134)
at org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntryImpl.getItemState(HierarchyEntryImpl.java:253)
at org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntryImpl.getItemState(NodeEntryImpl.java:71)
at org.apache.jackrabbit.jcr2spi.ItemManagerImpl.getItem(ItemManagerImpl.java:193)
at org.apache.jackrabbit.jcr2spi.SessionImpl.getRootNode(SessionImpl.java:233)
at GetRepository.main(GetRepository.java:28)

Kindly help me in getting this resolved. Thanks in advance.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Make sure that you use the correct JAR version - as stated in the article at the beginning. For AEM 6.1 - you can use jackrabbit-standalone-2.6.5.jar. I just tested and it works - as shown here: 

View solution in original post

3 Replies

Avatar

Level 10

Hi,

Are you sure your slf4j loggers are not creating problems? can you try to remove them all and see it works or not.

Avatar

Correct answer by
Level 10

Make sure that you use the correct JAR version - as stated in the article at the beginning. For AEM 6.1 - you can use jackrabbit-standalone-2.6.5.jar. I just tested and it works - as shown here: 

Avatar

Level 4

hi Scott,

I tried using 2.9 version jar with AEM 6.1 and got this exception while connecting to jcr.

javax.jcr.lock.LockException: Precondition Failed