Add the following dependencies into your Web Application (e.g., '/site') where you want a remote repository.
<!-- SNIP --> <!-- Infer jackrabbit.version from hippo.jackrabbit.version in your project. For example, you can take "2.16.1" for jackrabbit.version, from "2.16.1-h2" of hippo.jackrabbit.version property here. --> <dependency> <groupId>org.apache.jackrabbit</groupId> <artifactId>jackrabbit-jcr2dav</artifactId> <version>${jackrabbit.version}</version> </dependency> <dependency> <groupId>org.onehippo.forge.hipporepojcrdav</groupId> <artifactId>hipporepojcrdav-connector</artifactId> <version>${forge.hipporepojcrdav.version}</version> </dependency> <!-- SNIP -->
In order to use a remote Hippo Repository in your web application, you have to configure JNDI Resource. As an example, in Tomcat, you can add the following JNDI Resource in the context configuration like the following example:
<Context crossContext="true"> <!-- SNIP --> <Resource name="jcr/davexRepository" auth="Container" type="org.onehippo.forge.repository.connector.remoting.davex.HippoJcrRepository" factory="org.onehippo.forge.repository.connector.remoting.davex.DavExHippoRepositoryBasedHippoJcrRepositoryFactory" repositoryAddress="http://localhost:8080/cms/server" /> <!-- SNIP --> </Context>
In order to use a remote Hippo Repository in your web application, you also have to add JNDI Resource Reference element in web.xml like the following example:
<resource-ref> <description>JCR Repository</description> <res-ref-name>jcr/davexRepository</res-ref-name> <res-type>org.onehippo.forge.repository.connector.remoting.davex.HippoJcrRepository</res-type> <res-auth>Container</res-auth> </resource-ref>
Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); Repository repository = (Repository) envCtx.lookup("jcr/davexRepository");