Expand my Community achievements bar.

SOLVED

Not able to connect to CRX repository from standalone class

Avatar

Level 2
Level 2

Hi All,

I have written simple Java class to connect to repository and get the session but it's throwing below error.

javax.jcr.RepositoryException: Unable to access a repository with the following settings:

   org.apache.jackrabbit.repository.uri: http://<hostname>:<port>/wcm_author/crx/server

The following RepositoryFactory classes were consulted:
    org.apache.jackrabbit.jcr2dav.Jcr2davRepositoryFactory: declined
    org.apache.jackrabbit.jcr2spi.Jcr2spiRepositoryFactory: declined
    org.apache.jackrabbit.commons.JndiRepositoryFactory: declined
Perhaps the repository you are trying to access is not available at the moment.
    at org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:223)
    at org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:263)
    at GetCRXSession.getCRXSession(GetCRXSession.java:16)
    at GetCRXSession.main(GetCRXSession.java:29)
Exception in thread "main" java.lang.NullPointerException
    at GetCRXSession.main(GetCRXSession.java:29)

My CQ(Vers. AEM 5.6.1) instance is running as part JBOSS server,do i need to change any configurations(like sling.properties or any) to connect to repository.I have placed below listed jars in eclipse class path.

commons-codec-1.9.jar
commons-collections-3.2.1.jar
commons-httpclient-3.1.jar
commons-logging-1.2.jar
jackrabbit-jcr2dav-2.5.3.jar
jackrabbit-jcr2spi-2.6.2.jar
jackrabbit-jcr-commons-2.7.0.jar
jackrabbit-spi-2.7.0.jar
jackrabbit-spi2dav-2.6.2.jar
jackrabbit-spi-commons-2.7.0.jar
jackrabbit-webdav-2.6.2.jar
jcr-2.0-b19.jar
slf4j-api-1.6.6.jar

If anyone came across already issue ,please help me.

Thanks In Advance

Thanks,

Kishore

1 Accepted Solution

Avatar

Correct answer by
Level 10
3 Replies

Avatar

Level 2

Hi Kishore,

Check this post https://forums.adobe.com/thread/1073631

Looks like you are missing  jackrabbit-jcr2dav library from the classpath.

You can download jar from http://mvnrepository.com/artifact/org.apache.jackrabbit/jackrabbit-jcr2dav/2.9.0

If you are using pom check following post https://forums.adobe.com/thread/1116381

OR

Is ur repository URI http://10.157.129.59:25017/wcm_author/crx/server correct?

I am able to access through http://localhost:4502/crx/server (using cq5.5) 

[img]Repos.png[/img]

Thanks,

Jayaram S

Avatar

Level 2
Level 2

Hi,

I have kept the jar you suggested already but seeing the error.

I am able to access http://<hostname>:<port>/wcm_author/crx/server directly from browser.

And my CQ instance is running as part of JBOSS.....

Thanks,

Kishore

Avatar

Correct answer by
Level 10