AEM 6.1 Programmatically accessing cq content using JCR API : Exception in "main" thread java.lang.NoSuchMethodError. HELP REQUIRED | Community
Skip to main content
November 17, 2015
Solved

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

  • November 17, 2015
  • 3 replies
  • 1533 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

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: 

3 replies

edubey
Level 10
November 17, 2015

Hi,

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

smacdonald2008
smacdonald2008Accepted solution
Level 10
November 17, 2015

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: 

sureshy2015
Level 4
February 11, 2016

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