Install CRISP Addon as a Shared Module

Overview

In some scenarios, you may want to maintain a single set of CRISP ResourceResolver configurations within the CMS (also referred to as the "Platform") web application. Using the shared module deployment model, all web applications can access the same ResourceResolver definitions without duplicating configuration. This page describes how to install the CRISP Addon using the shared module deployment approach.

Implementation Steps

Enable ResourceServiceBroker Sharing in HST-2 Container Configuration

To register the ResourceServiceBroker component as a shared service, add the following property to your HST-2 Container Configuration file. This file is typically located at ${catalina.base}/conf/hst.properties or cms/src/main/webapp/WEB-INF/hst-config.properties.

# ...
# Register the shared ResourceServiceBroker with the HippoServiceRegistry
crisp.broker.registerService = true
# ...

With this configuration, the ResourceServiceBroker component is initialized and shared by the CMS (Platform) web application. Other web applications can access the shared component using CrispHstServices.getDefaultResourceServiceBroker(HstServices.getComponentManager()).

Configure Jackson Annotation and CRISP API as Provided Dependencies

The following JAR dependencies must be shared across web applications:

  • Jackson Annotation (com.fasterxml.jackson.core:jackson-annotations)
  • CRISP API (org.onehippo.cms7:hippo-addon-crisp-api)

Declare both dependencies with provided scope in the root pom.xml:

<dependencyManagement> <dependencies> <!-- SNIP --> <!-- Add these as provided with version numbers in dependencyManagement/dependencies. --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>${jackson2.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.onehippo.cms7</groupId> <artifactId>hippo-addon-crisp-api</artifactId> <version>${hippo.addon-crisp.version}</version> <scope>provided</scope> </dependency> <!-- SNIP --> </dependencies> </dependencyManagement> <dependencies> <!-- SNIP --> <!-- Add these as provided in dependencies; no need to add these in cargo.run and dist profiles again. --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.onehippo.cms7</groupId> <artifactId>hippo-addon-crisp-api</artifactId> <scope>provided</scope> </dependency> <!-- SNIP --> </dependencies>

Configure Shared Dependencies for the cargo.run Profile

To make the shared JAR dependencies available on the shared classpath when running with mvn -Pcargo.run, configure them in the cargo.run profile. This ensures the Tomcat container provides these JAR files.

Add the dependencies to the cargo container configuration with shared classpath settings:

<profile> <id>cargo.run</id> <dependencies> <!-- SNIP --> </dependencies> <build> <plugins> <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven3-plugin</artifactId> <configuration> <configuration> <!-- SNIP --> </configuration> <deployables> <!-- SNIP --> </deployables> <container> <systemProperties> <!-- SNIP --> </systemProperties> <dependencies> <!-- SNIP --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <classpath>shared</classpath> </dependency> <dependency> <groupId>org.onehippo.cms7</groupId> <artifactId>hippo-addon-crisp-api</artifactId> <classpath>shared</classpath> </dependency> <!-- SNIP --> </dependencies> </container> </configuration> </plugin> </plugins> </build> </profile>

Package Shared Dependencies for the dist Profile

When building a tar.gz distribution with the dist profile, package the shared JAR dependencies into the shared/lib directory.

Add the dependencies in src/main/assembly/shared-lib-component.xml:

<component xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2 http://maven.apache.org/xsd/component-1.1.2.xsd"> <dependencySets> <dependencySet> <useProjectArtifact>false</useProjectArtifact> <outputDirectory>shared/lib</outputDirectory> <scope>provided</scope> <includes> <!-- SNIP --> <include>com.fasterxml.jackson.core:jackson-annotations</include> <include>org.onehippo.cms7:hippo-addon-crisp-api</include> <!-- SNIP --> </includes> </dependencySet> </dependencySets> </component>

Add Dependencies to the CMS (Platform) Web Application

In the CMS (Platform) web application's cms-dependencies/pom.xml, add the following dependencies:

<dependencies> <!-- SNIP --> <dependency> <groupId>org.onehippo.cms7</groupId> <artifactId>hippo-addon-crisp-api</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.onehippo.cms7</groupId> <artifactId>hippo-addon-crisp-core</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.onehippo.cms7</groupId> <artifactId>hippo-addon-crisp-hst</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.onehippo.cms7</groupId> <artifactId>hippo-addon-crisp-repository</artifactId> <scope>runtime</scope> </dependency> <!-- SNIP --> </dependencies>

Add Dependencies to Content Delivery Web Application(s)

In each content delivery web application's site/components/pom.xml, add the following dependency:

<dependencies> <!-- SNIP --> <dependency> <groupId>org.onehippo.cms7</groupId> <artifactId>hippo-addon-crisp-api</artifactId> <scope>provided</scope> </dependency> <!-- SNIP --> </dependencies>

Verification

After completing these steps, all web applications will use the shared CRISP ResourceResolver configurations provided by the CMS (Platform) web application. No additional configuration is required in individual web applications.

Troubleshooting

If a web application cannot access the shared ResourceServiceBroker, verify the following:

  • The crisp.broker.registerService property is set to true in the CMS configuration.
  • The shared dependencies are present on the shared classpath in both cargo.run and dist profiles.
  • All relevant dependencies are declared with the correct scope in each web application's pom.xml.

If issues persist, review the Tomcat logs for errors related to class loading or missing dependencies.

Share Feedback
Page: /build/crisp-api/introduction-config/shared-module-deployment
Section: Build
Category *