Hi,
I am trying to connect to remote CRX repository of CQ5.3 from CQ5.5 application code. I tried using the below code as suggested in adobe documentation.
But I am getting exception as below. Is there anything that I am missing or Is there any other way to get access to the nodes of 5.3 remote repository.
Exception in thread "main" javax.jcr.RepositoryException: Unable to access a repository with the following settings:
org.apache.jackrabbit.repository.uri: http://localhost:4502/crx/server
The following RepositoryFactory classes were consulted:
org.apache.jackrabbit.commons.JndiRepositoryFactory: declined
org.apache.jackrabbit.rmi.repository.RmiRepositoryFactory: failed
because of RepositoryException: Failed to read the resource at URL http://localhost:4502/crx/server
because of StreamCorruptedException: invalid stream header: 3C68746D
Perhaps the repository you are trying to access is not available at the moment.
at org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:217)
at org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:257)
at com.wsgc.digitalasset.constants.TestMigration.main(TestMigration.java:17)
publicstaticvoid main(String[] args) throws ClassCastException, MalformedURLException, RemoteException, NotBoundException, LoginException, NoSuchWorkspaceException, RepositoryException, NamingException {
System.out.println("Hello World.");
//RMI Connection
// Repository repository = JcrUtils.getRepository("rmi://localhost:4502/crx/server");
Repository repository = JcrUtils.getRepository("http://localhost:4502/crx/server");
//Workspace Login
SimpleCredentials creds = new SimpleCredentials("admin", "admin".toCharArray());
Session session = null;
session = repository.login(creds, "crx.default");
//List Children
System.out.println("Workspace: " + session.getWorkspace().getName() + "\n");
listChildren( "", session.getRootNode() );
}
privatestaticvoid listChildren(String indent, Node node ) throws RepositoryException {
System.out.println(indent + node.getName() );
NodeIterator ni = node.getNodes();
while(ni.hasNext()) {
listChildren(indent+" ", ni.nextNode());
}
}