Building HippoCMS docker image with Oracle Database 12c

Hello,
I would like to prepare a CMS docker image(container) connecting to Oracle 12c database. I am quite new to docker realm and also bloomreach. I read following pages and gave it a try but I have not yet made any progress:

It seems for H2, MySQL and PostgreSQL everything is so easy and prepared and would be done through the Maven’s Profile but for Oracle Database more effort need to be made.
Generally, is there any other document/instruction which explain this procedure with more details because several questions have been raised for me:

  • What do I have to do to modify database type from default H2 to Oracle 12c? where should I put my configured repository.xml?
  • Where should I place database driver(ojdbc8)? I mean it should be done by changing the docker file or I should place it in $TOMCAT_HOME/lib after creation of docker image?

Thank you in advance,
Amirhossein Farmad

Which version of brXM are you using?

hippo CMS 13.3.0
I followed this instruction to create the project.


Now, I would like to change the database to Oracle and then create a docker image.

Great, then you can take advantage of the ootb docker support. Oracle db setup does not come with it, but it is supported. You just have to do some work.

  • First of all, check out [1]. There, you can see that you need 1)repository.xml for oracle 2) context.xml for oracle. This page will have those.
  • Take a look at the existing postgresql setup for example in the project. You have a repository-postgresql.xml there for instance. You should add your repository-oracle.xml next to that one for example. Check in detail the repositoy-postgresql.xml: you’ll see that there are variables in there which are surrounded by two “@” characters (example: “@cluster.node.id@” ). Do the same for your repository-oracle.xml
  • Take a look at the existing context-postgresql.xml for the same kind of variables (two “@” signs). Do the same for your own context-oracle.xml
  • go to src/main/docker/scripts and take a look at the postgres folder. There you can find a script that substitutes the “@” variables with environment variables. Also copy this behavior for your oracle db.
  • In your dockerfile pass the correct repo config file reference with an environment variable:
    REPO_CONFIG = “file://${CATALINA_HOME}/conf/repository-oracle.xml”

This should be it, hopefully I didn’t miss anything. Good luck!

[1] https://documentation.bloomreach.com/library/deployment/configuring/configuring-hippo-for-oracle-database.html

1 Like

Thanks bcanvural, I followed your instruction.

  1. conf\repository-oracle.xml was created and the variables were set.
  2. conf\context-oracle.xml was created and the variables were set.
  3. src\main\docker\scripts\oracle\setup-db.sh was created and the variables were set.
  4. src\main\docker\scripts\oracle\setup-db.sh was modified.
  5. Then following commands was executed:
    mvn clean install
    mvn -P docker.build
    mvn -P docker.run
    and I came across this error during the run:

java.sql.SQLException: Cannot load JDBC driver class ‘oracle.jdbc.OracleDriver’
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver

  1. It seems ojdbc8 was not placed at its rigth place “gam-cms\target\docker\com.gam\gamcms\0.1.0-SNAPSHOT\build\maven\db-drivers\oracle\ojdbc8” so as to finally copy to “tomcat\libs”. Therefore I made these changes to force the maven profile to make a “oracle” directory at “\build\maven\db-drivers” such as postgres and mysql and then put the ojdbc8 there.
  2. I declared a new profile:

<profile>
  <id>oracle</id>
</profile>
<profile>
  <id>docker.oracle</id>
  <properties>
    <docker.db.host>xxx</docker.db.host>
    <docker.db.port>xxx</docker.db.port>
    <docker.db.schema>xxx</docker.db.schema>
    <docker.db.username>xxx</docker.db.username>
    <docker.db.password>xxx</docker.db.password>
    <docker.db.bind.1>${project.basedir}/target/oracle-data:/var/lib/oracle/data</docker.db.bind.1>
    <docker.db.bind.2>${project.basedir}/db-bootstrap:/docker-entrypoint-initdb.d</docker.db.bind.2>
    <docker.brxm.envRun.ORACLE_DB_HOST>${docker.container.db.net.gamcms-network.ip}</docker.brxm.envRun.ORACLE_DB_HOST>
  </properties>
  <dependencies>
    <dependency>
      <groupId>com.oracle.jdbc</groupId>
      <artifactId>ojdbc8</artifactId>
      <version>12.2.0.1</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
</profile>

  1. I added a new dependencySet at “\gam-cms\src\main\docker\assembly\docker-db-libs.xml”:

<dependencySet>
  <useProjectArtifact>false</useProjectArtifact>
  <outputDirectory>db-drivers/oracle</outputDirectory>
  <scope>provided</scope>
  <includes>
    <include>com.oracle.jdbc:ojdbc8</include>
  </includes>
</dependencySet>

  1. I added following changes at “\gam-cms\src\main\docker\assembly\conf-component-docker.xml”:

<file>
  <source>conf/context-oracle.xml</source>
  <outputDirectory>conf</outputDirectory>
  <filtered>false</filtered>
</file>
<file>
  <source>conf/repository-oracle.xml</source>
  <outputDirectory>conf</outputDirectory>
  <filtered>false</filtered>
</file>

  1. Following commands was executed:
    mvn clean install
    mvn -P docker.build
    mvn -P docker.run,oracle
    and again I came across the same error during the run because the “gam-cms\target\docker\com.gam\gamcms\0.1.0-SNAPSHOT\build\maven\db-drivers\oracle\ojdbc8” has not yet created. I think this warning can be a clue to understand why it doesn’t create this directory like Postgresql and MySQL. Do you have any idea what I have to do:
    [INFO] Reading assembly descriptor: \gam-cms\src\main\docker\assembly\distribution-docker.xml
    [WARNING] The following patterns were never triggered in this artifact inclusion filter:
    o ‘com.oracle.jdbc:ojdbc8’

HI again,

Check the hippo-cms7-release-13.x.y.pom. in there, in the dependency management section there are connector jars listed. Did you add the oracle db jar just like those in your project?

If it works for postgres but not your case essentially I would look into the parent poms of the project and see how dependencies are setup for mysql and postgres.