Jahia in English > How to connect to...

0 (0 Good)
0 (0 Bad)

How to connect to Jahia JCR repository from outside ?

by  thbaymet »  2015/11/05 13:16

Hi,

I would like to know if we can access to a local Jahia JCR by using Jackrabbit tools. As an example I tried to acces with the following code but I couldn't.

String url = "http://localhost:8080/";
System.out.println("Connecting to " + url);
Repository repository = JcrUtils.getRepository(url);
SimpleCredentials creds = new SimpleCredentials("root", "root".toCharArray());
Session session = repository.login(creds, "default");
System.out.println("Login successful, workspace: " + session.getWorkspace());

try {
    Node rootNode = session.getRootNode();
    
} finally {
    session.logout();
}

Thanks.

  • How to connect to Jahia JCR repository from outside ?
    2015/11/05 13:16

    thbaymet <p>Hi,</p> <p>I would like to know if we can access to a local Jahia JCR by using Jackrabbit tools. As an example I tried to acces with the following code but I couldn&#39;t.</p> <pre style="background-color:#2b2b2b;color:#a9b7c6;font-family:'Source Code Pro';font-size:10,6pt;"> <span style="background-color:#344134;">String</span> url = <span style="color:#6a8759;">&quot;http://localhost:8080/&quot;</span><span style="color:#cc7832;">; </span>System.<span style="color:#9876aa;font-style:italic;">out</span>.println(<span style="color:#6a8759;">&quot;Connecting to &quot; </span>+ url)<span style="color:#cc7832;">; </span>Repository repository = JcrUtils.<span style="font-style:italic;">getRepository</span>(url)<span style="color:#cc7832;">; </span>SimpleCredentials creds = <span style="color:#cc7832;">new </span>SimpleCredentials(<span style="color:#6a8759;">&quot;root&quot;</span><span style="color:#cc7832;">, </span><span style="color:#6a8759;">&quot;root&quot;</span>.toCharArray())<span style="color:#cc7832;">; </span>Session session = repository.login(creds<span style="color:#cc7832;">, </span><span style="color:#6a8759;">&quot;default&quot;</span>)<span style="color:#cc7832;">; </span>System.<span style="color:#9876aa;font-style:italic;">out</span>.println(<span style="color:#6a8759;">&quot;Login successful, workspace: &quot; </span>+ session.getWorkspace())<span style="color:#cc7832;">; </span> <span style="color:#cc7832;">try </span>{ Node rootNode = session.getRootNode()<span style="color:#cc7832;">; </span><span style="color:#cc7832;"> </span>} <span style="color:#cc7832;">finally </span>{ session.logout()<span style="color:#cc7832;">; </span>}</pre> <p>Thanks.</p>

  • Number of messages  19
    Registration date Nov 5, 2015
    0 (0 Good)
    0 (0 Bad)

    Re: How to connect to Jahia JCR repository from outside ?

    by  shyrkov »  2015/11/10 21:18

    Hello,

    I doubt, this is currently possible.

    The spi2dav protocol (which is used in your case) is not enabled on Digital Factory side, so the JcrUtils.getRepository() won't be able to connect.

    Kind regads

    Sergiy

  • Re: How to connect to Jahia JCR repository from outside ?
    2015/11/10 21:18

    shyrkov <p>Hello,</p> <p>I doubt, this is currently possible.</p> <p>The&nbsp;spi2dav protocol (which is used in your case) is not enabled on Digital Factory side, so the JcrUtils.getRepository() won&#39;t be able to connect.</p> <p>Kind regads</p> <p>Sergiy</p>

  • Number of messages  407
    Registration date Nov 10, 2015
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page