Using the JCR-Explorer with Sling

jcr-explorer-with-sling-200.jpgHere’s how to configure the JCR-Explorer tool under Tomcat, to use it with Sling.

Tested with Tomcat 6.0.18, JDK 1.5 and the Sling launchpad/webapp from revision 731934.

Starting with a fresh Tomcat install, add this to conf/server.xml, inside <GlobalNamingResources>:

<Resource name="jcr/globalRepository"
  auth="Container"
  type="javax.jcr.Repository"
  factory="org.apache.jackrabbit.rmi.client.ClientRepositoryFactory"
  url="rmi://127.0.0.1:1099/jackrabbit"/>

Add this to conf/context.xml, inside <Context>:

<ResourceLink name="jcr/repository"
  global="jcr/globalRepository"
  type="javax.jcr.Repository"/>

Copy the jcr-explorer.war file to the tomcat webapps folder, start tomcat,
stop it (so that the webapp is expanded) and add this at the end of webapps/jcr-explorer/WEB-INF/web.xml, inside <web-app>:

<ResourceLink name="jcr/repository"
  global="jcr/globalRepository"
  type="javax.jcr.Repository"/>

Copy these two jar files to the lib folder (or common/lib for Tomcat 5):
jackrabbit-jcr-rmi-1.5.0.jar and jcr-1.0.jar.

Start Sling with the RMI export of the repository enabled. That’s standard if you start the Sling launchpad/webapp module with mvn jetty:run, for example. Sling can either run inside Tomcat, or standalone, as the connection is made via RMI.

On the jcr-explorer login page (http://localhost:8080/jcr-explorer/login.jsf), use java:comp/env/jcr/repository as the JNDI URL, and admin/admin for login and password.

You should now see the JCR-Explorer page, as in our screenshot, displaying the contents of the Sling repository in the left pane (index.html, sling-logo.png, etc.).

This JCR-Explorer setup can be used to access any Jackrabbit repository accessible via rmi://127.0.0.1:1099/jackrabbit, that should work with plain Jackrabbit setups as well, of course.

See the JCR-Explorer website for more info about how to use that tool.

12 Responses to Using the JCR-Explorer with Sling

  1. Renaud says:

    thanks Bertrand, works well!

  2. kiksamerik1 says:

    Good work!!
    Can you get this working on JBoss portal embedded repository?
    Does the web app conf jcr-explorer change?

  3. bdelacretaz says:

    I’m not familiar with the JBoss portal embedded repository, that would rather be a question for the jcr-explorer developers.

  4. signalpillar says:

    Hi, Bertrand! How do you run repository to make it available through RMI ? If as a standalone repository server – i can only configure http port (for jackrabbit 1.5.6 http://jackrabbit.apache.org/jackrabbit-standalone.html)…

    There are 2 default urls
    * RMI registry: //localhost/jackrabbit.repository
    * HTTP download: http://localhost:8081/rmi
    I’ve tried first one – but can not connect ‘connection refused’ (it is ok with my firewall). If make it like this

    //localhost:1099/jackrabbit.repository (connection refused)
    //localhost:8081/jackrabbit.repository (A ‘org.apache.jackrabbit.rmi.client.RemoteRepositoryException’ has occured. Reason: non-JRMP server at remote endpoint).

    Help please or give me a hint where to look for

  5. signalpillar says:

    Hi, Bertrand! How do you run repository to make it available through RMI ? If as a standalone repository server – i can only configure http port (for jackrabbit 1.5.6 http://jackrabbit.apache.org/jackrabbit-standalone.html)…

    There are 2 default urls
    * RMI registry: //localhost/jackrabbit.repository
    * HTTP download: http://localhost:8081/rmi
    I’ve tried first one – but can not connect ‘connection refused’ (it is ok with my firewall). If make it like this.
    Thanks

    //localhost:1099/jackrabbit.repository (connection refused)
    //localhost:8081/jackrabbit.repository (A ‘org.apache.jackrabbit.rmi.client.RemoteRepositoryException’ has occured. Reason: non-JRMP server at remote endpoint).

    Help please or give me a hint where to look for

  6. signalpillar says:

    Ok, but how did YOU run it ? Your experience is interested in this situation.

  7. colims says:

    There are 2 default urls
    * RMI registry: //localhost/jackrabbit.repository
    * HTTP download: http://localhost:8081/rmi
    I’ve tried first one – but can not connect ‘connection refused’ (it is ok with my firewall). If make it like this

    //localhost:1099/jackrabbit.repository (connection refused)
    //localhost:8081/jackrabbit.repository (A ‘org.apache.jackrabbit.rmi.client.RemoteRepositoryException’ has occured. Reason: non-JRMP server at remote endpoint).

    Help please or give me a hint where to look for

  8. Hi Bertrand,

    I realize that what I am asking is not related to jcr-explorer. It has to do with the sling provided jquery explorer bundled with the latest sling version. I did not know where to ask the question, and hence I am asking it here.

    If I should be raising this in a different forum or mailing list please point me there, and I will do so.

    I downloaded and deployed sling launchpad 6 in apache tomcat 6.0.32 (OS: windows xp). My sling URL is http://localhost:8080/sling-launchpad-6/

    I am able to successfully create content with the curl command:
    curl -u admin:admin -F”sling:resourceType=foo/bar” -F”title=Foo Bar” http://localhost:8080/sling-launchpad-6/content/foonode
    and view it via http://localhost:8080/sling-launchpad-6/content/foonode.json or foonode.html

    However when I navigate to explorer URL http://localhost:8080/sling-launchpad-6/.explorer.html as per the sling documentation, while I get the basic interface, I also get a “HTTP Status 404 – /.explorer.item.html” error.

    I am however able to manually navigate to http://localhost:8080/sling-launchpad-6/.explorer.item.html it displays the a set of resource links.

    I must have missed something in the configuration or setup, but I cant figure out what!

    These are the links displayed, although clicking on them does not do anything. They are HREFed to “#”
    jcr:system
    rep:policy
    var
    apps
    index.html
    signup.html
    sling-logo.png
    sling-test
    sling.css
    content
    libs
    system

    Thanks
    Santosh

  9. In continuation of the previous post, the URL http://localhost:8080/sling-launchpad-6/content/.explorer.item.html displays foonode which was the content I create via the curl command.

    And yet, I am not able to navigate to this using the explorer.

    Thanks
    Santosh

Follow

Get every new post delivered to your Inbox.

Join 29 other followers

%d bloggers like this: