Run brXM 15 on Java 17

Introduction

Goal

Build and run a Bloomreach Experience Manager implementation project on Java 17.

Summary

Bloomreach supports Java 11 for brXM 15. This means that brXM 15 is tested and guaranteed to work with Java 11.

Although not supported by Bloomreach, it is possible to run brXM 15 on Java 17 by making a few minor configuration changes described on this page.

Please note that Bloomreach does not test brXM 15 with Java 17 and therefore does not guarantee it will work as expected. This documentation page is provided as-is and is to be used at your own risk.

The following instructions assume a brXM 15 project created from the Maven archetype.

Steps

Use the --add-opens option

Some libraries used by brXM 15 need access to non-public fields and methods of java.* APIs. This is no longer possible by default on JDK 17, but you can use the --add-opens option on the command line to enable it for specific tools and libraries.

To do this for the local Cargo development enviroment, override the cargo.jvmargs from the hippo-project POM in the cargo.run profile in your project's root pom.xml:

  <artifactId>cargo-maven2-plugin</artifactId>
  <configuration>
    <configuration>
      <properties>
        <cargo.jvmargs>
          <![CDATA[-agentlib:jdwp=transport=dt_socket,address=${cargo.debug.address},server=y,suspend=${cargo.debug.suspend} -noverify ${javaagent} --add-opens java.base/java.util=ALL-UNNAMED ${cargo.jvm.args}]]>
        </cargo.jvmargs>
      </properties>

In deployed environments, the --add-opens option should be added to the JVM_OPTS environment variable if you follow our Configure the Application Server (Apache Tomcat on Linux) guide.

Update Byte Buddy Dependency

The dynamic content beans features uses Byte Buddy. The Byte Buddy library included in brXM 15 is incompatible with Java 17.

To update the Byte Buddy dependency, make the following changes to your project.

In the root pom.xml, add the following to the <properties> section:

<bytebuddy.version>1.12.21</bytebuddy.version>

In site/components/pom.xml, find the hippo-package-site-dependencies dependency and add an exclusion for byte-buddy:

    <dependency>
      <groupId>org.onehippo.cms7</groupId>
      <artifactId>hippo-package-site-dependencies</artifactId>
      <type>pom</type>
      <exclusions>
        <exclusion>
          <groupId>net.bytebuddy</groupId>
          <artifactId>byte-buddy</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

And add a separate dependency for byte-buddy:

    <dependency>
      <groupId>net.bytebuddy</groupId>
      <artifactId>byte-buddy</artifactId>
      <version>${bytebuddy.version}</version>
    </dependency>
Alternatively, you may choose to disable dynamic content beans using the -Ddynamic.bean.generation=false flag.

Rebuild & Run

After making the above changes, you should be able to build and run your brXM 15 project on Java 17.

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?