Repository repository = JcrUtils.getRepository("http://localhost:4502/crx/server"); Session session = repository.login(new SimpleCredentials("admin", "admin".toCharArray())); // Obtain the query manager for the session via the workspace ... QueryManager queryManager = session.getWorkspace().getQueryManager(); // Create a query object ... String expression = "SELECT * FROM [sling:OrderedFolder] AS s WHERE ISDESCENDANTNODE([/docIDsDB])"; Query query = queryManager.createQuery(expression, javax.jcr.query.Query.JCR_SQL2); // Execute the query and get the results ... QueryResult result = query.execute(); // Iterate over the nodes in the results ... NodeIterator nodeIter = result.getNodes(); session.logout(); while(nodeIter.hasNext()){ Node node = nodeIter.nextNode(); System.out.println(node.getProperty("url").getString()); System.out.println(node.getProperty("docid").getString()); }