Running a local environment with a local mysql database

Hi

I am trying to configure my local environment to run a Bloomreach instance (mvn cargo.run) with a local mysql database.

I have followed all topics in this comunity but I am not able to start the Tomcat without the error

[INFO] [talledLocalContainer] 30-Jan-2023 16:35:43.880 INFO [main] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of deployment descriptor [C:\Code_Bloomreach\devhub.build.brx-internal\target\tomcat9x\conf\Catalina\localhost\site.xml] has finished in [10.186] ms
[INFO] [talledLocalContainer] 30-Jan-2023 16:35:43.884 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Despliegue del archivo [C:\Code_Bloomreach\devhub.build.brx-internal\target\tomcat9x\webapps\cargocpc.war] de la aplicación web
[WARNING] [talledLocalContainer] 30-Jan-2023 16:35:44.198 WARNING [main] org.apache.naming.NamingContext.lookup Excepción inesperada resolviendo referencia
[INFO] [talledLocalContainer]   java.sql.SQLException: Cannot load JDBC driver class 'com.mysql.cj.jdbc.Driver'
[INFO] [talledLocalContainer]           at org.apache.tomcat.dbcp.dbcp2.DriverFactory.createDriver(DriverFactory.java:53)
[INFO] [talledLocalContainer]           at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:462)
[INFO] [talledLocalContainer]           at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:526)
[INFO] [talledLocalContainer]           at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getLogWriter(BasicDataSource.java:1057)

I have followed:

HIPPO with Postgres (This one i for Postgres but I found it very useful)

Also read and apply:

In this one if I apply the configuration for the cargo plugin the Bloomreach use a Jetty instead Tomcat !!!

It is possible to do what I am trying to do???

Thank a lot.

My pom.xml

  <profile>
      <id>cargo.run</id>
      <properties>
        <!-- Already defined in the cms project POM. Override here for your project, if necessary -->
        <!-- <repo.bootstrap>true</repo.bootstrap> -->
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <configuration>
    <!-- <container>
      <dependencies>
        <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
          <classpath>extra</classpath>
        </dependency>
      </dependencies>
    </container> -->

If remove comments my local Bloomreach starts with Jetty.

   </dependency>
       <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
          <version>8.0.17</version>
        </dependency>

    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.bloomreach.forge.review-workflow</groupId>
      <artifactId>review-workflow-shared</artifactId>
      <version>${review-workflow.version}</version>
    </dependency>
     <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
          <version>8.0.17</version>
        </dependency>
  </dependencies>

I put the dependency in both parts project/dependencies and project/dependencyManagement with the same result in all combinatories

My context.xml

<Resource
      name="jdbc/repositoryDS" auth="Container" type="javax.sql.DataSource"
      maxTotal="20" maxIdle="10" initialSize="2" maxWaitMillis="10000"
      testWhileIdle="true" testOnBorrow="false" validationQuery="SELECT 1"
      timeBetweenEvictionRunsMillis="10000"
      minEvictableIdleTimeMillis="60000"
      username="root" password="root"
      driverClassName="com.mysql.cj.jdbc.Driver"
      url="jdbc:mysql://127.0.0.1:3306/bloomreachcms?serverTimezone=UTC&amp;characterEncoding=utf8&amp;useSSL=false"/>

Thanks in advance.

Hello, the error java.sql.SQLException: Cannot load JDBC driver class 'com.mysql.cj.jdbc.Driver' indicates an issue with declaring the dependencies in Maven. I followed the documentation at Use MySQL in a Development Environment - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS and applied it to a new 15.1.4 archetype project, it seems to work fine. I am attaching the pom.xml as well as the contenxt.xml and repository.xml. Tweak these as needed for your system.

root pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.onehippo.cms7</groupId>
    <artifactId>hippo-cms7-release</artifactId>
    <version>15.1.4</version>
  </parent>

  <name>My Project</name>
  <description>My Project</description>
  <groupId>org.example</groupId>
  <artifactId>myproject-mysql</artifactId>
  <version>0.1.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <!--
    The below project elements are emptied/overridden as otherwise their metadata would be
    inherited or merged from the parent hippo-cms7-release pom (or its hippo-cms7-project pom).

    DO NOT remove these tags but instead fill them in appropriately as needed,
    UNLESS the inherited values are valid for your project.
  -->
  <url/>
  <inceptionYear/>
  <organization/>
  <licenses>
    <license/>
  </licenses>
  <mailingLists>
    <mailingList/>
  </mailingLists>
  <developers>
    <developer/>
  </developers>
  <contributors>
    <contributor/>
  </contributors>
  <issueManagement/>
  <!--
  <scm>
    <connection/>
    <developerConnection/>
    <url/>
  </scm>
  -->
  <ciManagement/>
  <distributionManagement>
    <repository>
      <id>-</id>
      <url>-</url>
    </repository>
    <snapshotRepository>
      <id>-</id>
      <url>-</url>
    </snapshotRepository>
  </distributionManagement>
  <!-- End of emptied/overridden metadata from parent hippo-cms7-release pom. -->

  <properties>

    <!--***START temporary override of versions*** -->
    <!-- ***END temporary override of versions*** -->
    <mysql-jdbc.version>8.0.28</mysql-jdbc.version>
    <essentials.version>15.1.4</essentials.version>
    <jsp-api.version>2.2</jsp-api.version>
    <taglibs.version>1.2.5</taglibs.version>

    <development-module-deploy-dir>shared/lib</development-module-deploy-dir>

    <docker.postgres.bind.1>${project.basedir}/target/postgres-data:/var/lib/postgresql/data</docker.postgres.bind.1>

    <hippo.cms.locales>nl,de,fr,es,zh</hippo.cms.locales>
    <buildNumber>${maven.build.timestamp}</buildNumber>
  </properties>

  <repositories>
    <repository>
      <id>hippo</id>
      <name>Hippo maven 2 repository.</name>
      <url>https://maven.bloomreach.com/repository/maven2/</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>${mysql-jdbc.version}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>${jsp-api.version}</version>
        <scope>provided</scope>
      </dependency>

      <!-- other predefined runtime scope versioned dependencies -->
      <dependency>
        <groupId>org.apache.taglibs</groupId>
        <artifactId>taglibs-standard-spec</artifactId>
        <version>${taglibs.version}</version>
        <scope>runtime</scope>
      </dependency>

      <dependency>
        <groupId>org.apache.taglibs</groupId>
        <artifactId>taglibs-standard-impl</artifactId>
        <version>${taglibs.version}</version>
        <scope>runtime</scope>
      </dependency>

      <!-- other predefined compile scope versioned dependencies -->
      <dependency>
        <groupId>org.freemarker</groupId>
        <artifactId>freemarker</artifactId>
        <version>${freemarker.version}</version>
      </dependency>

    </dependencies>
  </dependencyManagement>

  <build>
    <defaultGoal>package</defaultGoal>
    <pluginManagement>
      <plugins>
        <!--
          This plugin configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.
        -->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <goals>
                      <goal>regex-property</goal>
                    </goals>
                    <versionRange>[0.0,)</versionRange>
                  </pluginExecutionFilter>
                  <action>
                    <ignore/>
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
            <manifestEntries>
              <Implementation-Build>${buildNumber}</Implementation-Build>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>

    <profile>
      <id>default</id>
      <activation>
        <activeByDefault>true</activeByDefault>
        <property>
          <name>jrebel</name>
        </property>
      </activation>
      <modules>
        <module>cms-dependencies</module>
        <module>repository-data</module>
        <module>cms</module>
        <module>site</module>
        <module>essentials</module>
      </modules>
    </profile>

    <profile>
      <id>docker.build</id>
      <dependencies>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>${project.artifactId}-cms</artifactId>
          <version>${project.version}</version>
          <type>war</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>${project.artifactId}-webapp</artifactId>
          <version>${project.version}</version>
          <type>war</type>
          <scope>provided</scope>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>docker.run</id>
      <dependencies>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>${project.artifactId}-essentials</artifactId>
          <version>${project.version}</version>
          <type>war</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>${project.artifactId}-repository-data-development</artifactId>
          <version>${project.version}</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>${project.artifactId}-repository-data-site-development</artifactId>
          <version>${project.version}</version>
          <scope>provided</scope>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>mysql</id>
    </profile>

    <profile>
      <id>docker.mysql</id>
      <properties>
        <docker.db.bind.1>${project.basedir}/target/mysql-data:/var/lib/mysql</docker.db.bind.1>
        <docker.db.bind.2>${project.basedir}/db-bootstrap:/docker-entrypoint-initdb.d</docker.db.bind.2>

        <docker.brxm.envRun.MYSQL_DB_HOST>${docker.container.db.net.myproject-mysql-network.ip}</docker.brxm.envRun.MYSQL_DB_HOST>
      </properties>
    </profile>

    <profile>
      <id>postgres</id>
    </profile>

    <profile>
      <id>docker.postgres</id>
      <properties>
        <docker.db.bind.1>${docker.postgres.bind.1}</docker.db.bind.1>
        <docker.db.bind.2>${project.basedir}/db-bootstrap:/docker-entrypoint-initdb.d</docker.db.bind.2>

        <docker.brxm.envRun.POSTGRES_DB_HOST>${docker.container.db.net.myproject-mysql-network.ip}</docker.brxm.envRun.POSTGRES_DB_HOST>
      </properties>
    </profile>

    <profile>
      <id>docker.windows</id>
      <properties>
        <docker.postgres.bind.1>myproject-mysql-postgres-data:/var/lib/postgresql/data</docker.postgres.bind.1>
      </properties>
    </profile>

    <profile>
      <id>cargo.run</id>
      <properties>
        <!-- Already defined in the cms project POM. Override here for your project, if necessary -->
        <!-- <repo.bootstrap>true</repo.bootstrap> -->
      </properties>
      <dependencies>
        <dependency>
          <groupId>jakarta.xml.bind</groupId>
          <artifactId>jakarta.xml.bind-api</artifactId>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>jakarta.xml.ws</groupId>
          <artifactId>jakarta.xml.ws-api</artifactId>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>javax.annotation</groupId>
          <artifactId>javax.annotation-api</artifactId>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>jakarta.activation</groupId>
          <artifactId>jakarta.activation-api</artifactId>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>org.glassfish.jaxb</groupId>
          <artifactId>jaxb-runtime</artifactId>
          <scope>runtime</scope>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <configuration>
              <configuration>
                <configfiles>
                  <configfile>
                    <file>${project.basedir}/conf/context.xml</file>
                    <todir>conf/</todir>
                    <tofile>context.xml</tofile>
                  </configfile>
                  <configfile>
                    <file>${project.basedir}/conf/catalina-logging.properties</file>
                    <todir>conf/</todir>
                    <tofile>logging.properties</tofile>
                  </configfile>
                  <configfile>
                    <file>${project.basedir}/conf/hst-dev.properties</file>
                    <todir>conf/</todir>
                    <tofile>hst.properties</tofile>
                  </configfile>
                  <configfile>
                    <file>${project.basedir}/conf/platform-dev.properties</file>
                    <todir>conf/</todir>
                    <tofile>platform.properties</tofile>
                  </configfile>
                </configfiles>
                <files>
                  <file>
                    <file>${project.basedir}/repository-data/development/target/myproject-mysql-repository-data-development-${project.version}.jar</file>
                    <todir>${development-module-deploy-dir}</todir>
                  </file>
                  <file>
                    <file>${project.basedir}/repository-data/site-development/target/myproject-mysql-repository-data-site-development-${project.version}.jar</file>
                    <todir>${development-module-deploy-dir}</todir>
                  </file>
                </files>
              </configuration>
              <deployables>
                <deployable>
                  <type>war</type>
                  <properties>
                    <context>/cms</context>
                  </properties>
                  <location>${project.basedir}/cms/target/cms</location>
                </deployable>
                <deployable>
                  <location>${project.basedir}/site/webapp/target/site</location>
                  <type>war</type>
                  <properties>
                    <context>/site</context>
                  </properties>
                </deployable>
                <deployable>
                  <location>${project.basedir}/essentials/target/essentials</location>
                  <type>war</type>
                  <properties>
                    <context>/essentials</context>
                  </properties>
                </deployable>
              </deployables>
              <container>
                <dependencies>
                  <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <classpath>extra</classpath>
                  </dependency>
                </dependencies>
                <systemProperties>
                  <log4j.configurationFile>${project.basedir}/conf/log4j2-dev.xml</log4j.configurationFile>
                  <!-- enables auto export and web files watch: -->
                  <project.basedir>${project.basedir}</project.basedir>
                  <send.usage.statistics.to.hippo>true</send.usage.statistics.to.hippo>
                  <repo.config>file:${project.basedir}/conf/repository.xml</repo.config>
                </systemProperties>
              </container>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <!-- additional profile to combine with cargo:run to *not* bootstrap the development modules:
           $ mvn -P cargo.run,without-development-data -->
      <id>without-development-data</id>
      <properties>
        <development-module-deploy-dir>temp</development-module-deploy-dir>

        <!-- Comment out Dockerfile instruction that copies development modules to an image -->
        <docker.brxm.copy.dev.libs.cmd>#</docker.brxm.copy.dev.libs.cmd>
      </properties>
    </profile>

    <profile>
      <id>dist</id>
      <dependencies>
        <dependency>
          <groupId>jakarta.xml.bind</groupId>
          <artifactId>jakarta.xml.bind-api</artifactId>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>jakarta.xml.ws</groupId>
          <artifactId>jakarta.xml.ws-api</artifactId>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>javax.annotation</groupId>
          <artifactId>javax.annotation-api</artifactId>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>jakarta.activation</groupId>
          <artifactId>jakarta.activation-api</artifactId>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.glassfish.jaxb</groupId>
          <artifactId>jaxb-runtime</artifactId>
          <scope>provided</scope>
        </dependency>

        <dependency>
          <groupId>org.apache.logging.log4j</groupId>
          <artifactId>log4j-slf4j-impl</artifactId>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>jcl-over-slf4j</artifactId>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.logging.log4j</groupId>
          <artifactId>log4j-api</artifactId>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.logging.log4j</groupId>
          <artifactId>log4j-core</artifactId>
          <scope>provided</scope>
        </dependency>
      </dependencies>
      <build>
        <defaultGoal>validate</defaultGoal>
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>distro-assembly</id>
                <phase>validate</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <descriptors>
                    <descriptor>${project.basedir}/src/main/assembly/distribution.xml</descriptor>
                  </descriptors>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>dist-with-development-data</id>
      <dependencies>
        <dependency>
          <groupId>org.apache.logging.log4j</groupId>
          <artifactId>log4j-slf4j-impl</artifactId>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>jcl-over-slf4j</artifactId>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.logging.log4j</groupId>
          <artifactId>log4j-api</artifactId>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.logging.log4j</groupId>
          <artifactId>log4j-core</artifactId>
          <scope>provided</scope>
        </dependency>
      </dependencies>
      <build>
        <defaultGoal>validate</defaultGoal>
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>distro-assembly-with-development-data</id>
                <phase>validate</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <descriptors>
                    <descriptor>${project.basedir}/src/main/assembly/distribution-with-development-data.xml</descriptor>
                  </descriptors>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>

content.xml

<?xml version='1.0' encoding='utf-8'?>
<Context>
    <!-- Disable session persistence across Tomcat restarts HIPPO -->
    <Manager pathname="" />

    <!-- Change the default repository storage location -->
    <!--
    <Parameter name="repository-directory" value="/data/storage" override="false"/>
    -->

    <!-- Start the repository as a remote server and bind it on the specified address -->
    <!--
    <Parameter name="start-remote-server" value="true" override="false"/>
    <Parameter name="repository-address" value="rmi://127.0.0.1:1099/hipporepository" override="false"/>
    -->

    <!-- Enable this to let wicket output a wicketpath attribute for elements,
         see: https://www.onehippo.org/library/development/create-a-selenium-test-case.html -->
    <!--
    <Parameter name="output-wicketpaths" value="true"/>
    -->

    <Resource
            name="jdbc/repositoryDS" auth="Container" type="javax.sql.DataSource"
            maxTotal="20" maxIdle="10" initialSize="2" maxWaitMillis="10000"
            testWhileIdle="true" testOnBorrow="false" validationQuery="SELECT 1"
            timeBetweenEvictionRunsMillis="10000"
            minEvictableIdleTimeMillis="60000"
            username="root" password="root"
            driverClassName="com.mysql.cj.jdbc.Driver"
            url="jdbc:mysql://192.168.0.35:3306/myproject-mysql?characterEncoding=utf8&amp;useSSL=false&amp;allowPublicKeyRetrieval=true&amp;nullDatabaseMeansCurrent=true"/>

</Context>

repository.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE Repository
        PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 2.6//EN"
        "http://jackrabbit.apache.org/dtd/repository-2.6.dtd">

<Repository>

    <DataSources>
        <DataSource name="repositoryDS">
            <param name="driver" value="javax.naming.InitialContext"/>
            <param name="url" value="java:comp/env/jdbc/repositoryDS"/>
            <param name="databaseType" value="mysql"/>
        </DataSource>
    </DataSources>

    <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
        <param name="dataSourceName" value="repositoryDS"/>
        <param name="schemaObjectPrefix" value="repository_"/>
    </FileSystem>

    <Security appName="Jackrabbit">
        <SecurityManager class="org.hippoecm.repository.security.SecurityManager"/>
        <AccessManager class="org.hippoecm.repository.security.HippoAccessManager"/>
        <LoginModule class="org.hippoecm.repository.security.HippoLoginModule"/>
    </Security>

    <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>

    <Workspace name="${wsp.name}">
        <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
            <param name="dataSourceName" value="repositoryDS"/>
            <param name="schemaObjectPrefix" value="${wsp.name}_"/>
        </FileSystem>

        <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager">
            <param name="dataSourceName" value="repositoryDS"/>
            <param name="schemaObjectPrefix" value="${wsp.name}_"/>
            <param name="externalBLOBs" value="true"/>
            <param name="consistencyCheck" value="false"/>
            <param name="consistencyFix" value="false"/>
            <param name="bundleCacheSize" value="256"/>
        </PersistenceManager>

        <SearchIndex class="org.hippoecm.repository.FacetedNavigationEngineImpl">
            <param name="indexingConfiguration" value="indexing_configuration.xml"/>
            <param name="indexingConfigurationClass" value="org.hippoecm.repository.query.lucene.ServicingIndexingConfigurationImpl"/>
            <param name="path" value="${wsp.home}/index"/>
            <param name="useSimpleFSDirectory" value="true"/>
            <param name="useCompoundFile" value="true"/>
            <param name="minMergeDocs" value="100"/>
            <param name="volatileIdleTime" value="10"/>
            <param name="maxMergeDocs" value="100000"/>
            <param name="mergeFactor" value="5"/>
            <param name="maxFieldLength" value="10000"/>
            <param name="bufferSize" value="1000"/>
            <param name="cacheSize" value="1000"/>
            <param name="onWorkspaceInconsistency" value="log"/>
            <param name="forceConsistencyCheck" value="false"/>
            <param name="enableConsistencyCheck" value="false"/>
            <param name="autoRepair" value="true"/>
            <param name="analyzer" value="org.hippoecm.repository.query.lucene.StandardHippoAnalyzer"/>
            <param name="queryClass" value="org.apache.jackrabbit.core.query.QueryImpl"/>
            <param name="respectDocumentOrder" value="false"/>
            <param name="resultFetchSize" value="1000"/>
            <param name="extractorTimeout" value="100"/>
            <param name="extractorBackLogSize" value="100"/>
            <param name="excerptProviderClass" value="org.apache.jackrabbit.core.query.lucene.DefaultHTMLExcerpt"/>
            <param name="supportSimilarityOnStrings" value="true"/>
            <param name="supportSimilarityOnBinaries" value="false"/>
        </SearchIndex>

        <ISMLocking class="org.apache.jackrabbit.core.state.FineGrainedISMLocking"/>
    </Workspace>

    <Versioning rootPath="${rep.home}/version">
        <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
            <param name="dataSourceName" value="repositoryDS"/>
            <param name="schemaObjectPrefix" value="version_"/>
        </FileSystem>

        <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager">
            <param name="dataSourceName" value="repositoryDS"/>
            <param name="schemaObjectPrefix" value="version_"/>
            <param name="externalBLOBs" value="true"/>
            <param name="consistencyCheck" value="false"/>
            <param name="consistencyFix" value="false"/>
            <param name="bundleCacheSize" value="64"/>
        </PersistenceManager>

        <ISMLocking class="org.apache.jackrabbit.core.state.FineGrainedISMLocking"/>
    </Versioning>

    <Cluster>
        <Journal class="org.apache.jackrabbit.core.journal.DatabaseJournal">
            <param name="dataSourceName" value="repositoryDS"/>
            <param name="databaseType" value="mysql"/>
            <param name="schemaObjectPrefix" value="repository_"/>
            <param name="revision" value="${rep.home}/revision.log"/>
            <!-- clean up journal table -->
            <param name="janitorEnabled" value="true"/>
            <param name="janitorSleep" value="86400"/> <!-- a day in seconds -->
            <param name="janitorFirstRunHourOfDay" value="3"/>
        </Journal>
    </Cluster>

    <DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
        <param name="dataSourceName" value="repositoryDS"/>
        <param name="minRecordLength" value="1024"/>
        <param name="maxConnections" value="5"/>
        <param name="copyWhenReading" value="true"/>
    </DataStore>

</Repository>

Thank you very much David

I wil try it and get back to you as soon as possible.

Hi David

I have managed to make it work with your indications.

Thank you very much.

As I see you are an expert i would like to ask you something else

Do you know what is the content of this tables???

  • default_bundle

  • version_bundle

Thanks in advance.

Glad to hear it is working for you :slight_smile:

The _bundle tables is where Jackrabbit, which is the repository that the CMS uses to store all data, persists the nodes and all their properties. default_bundle would be for the default workspace while version_bundle is for storing versioning information. If you take a look at the repository.xml you can see where these are configured.

Thanks a lot.

We have a big version_bundle table (about 5Gb) and we would like to decrease its size, but we don´t know if this is possible.

And on another hand we are trying to migrate our MySQL database to a PostGres DB using the jackrabbit standalone server funtionality (GitHub - woonsanko/recipe-for-hippo-db-migration: Recipe for Hippo CMS Database Migration)
but when we execute the process is throwing a casting error

Exception in thread "main" java.lang.ClassCastException: class org.apache.jackrabbit.core.state.SharedItemStateManager cannot be cast to class org.hippoecm.repository.jackrabbit.HippoSharedItemStateManager (org.apache.jackrabbit.core.state.SharedItemStateManager and org.hippoecm.repository.jackrabbit.HippoSharedItemStateManager are in unnamed module of loader 'app')
        at org.hippoecm.repository.FacetedNavigationEngineImpl.doInit(FacetedNavigationEngineImpl.java:654)
        at org.apache.jackrabbit.core.query.AbstractQueryHandler.init(AbstractQueryHandler.java:78)
        at org.apache.jackrabbit.core.config.RepositoryConfigurationParser$1.getQueryHandler(RepositoryConfigurationParser.java:683)
        at org.apache.jackrabbit.core.config.WorkspaceConfig.getQueryHandler(WorkspaceConfig.java:251)
        at org.apache.jackrabbit.core.SearchManager.<init>(SearchManager.java:171)
        at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.getSearchManager(RepositoryImpl.java:1902)
        at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doPostInitialize(RepositoryImpl.java:2140)
        at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.initialize(RepositoryImpl.java:2038)
        at org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(RepositoryImpl.java:544)
        at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:327)
        at org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:616)
        at org.apache.jackrabbit.core.RepositoryCopier.copy(RepositoryCopier.java:110)
        at org.apache.jackrabbit.standalone.Main.backup(Main.java:248)
        at org.apache.jackrabbit.standalone.Main.run(Main.java:172)
        at org.apache.jackrabbit.standalone.Main.main(Main.java:59)

And this is my life and my problems with BloomReach :joy:

If you can tell me something that can help me, I would be very grateful and I promise you if you come to Spain (Madrid) I will invite you a few beers and tyipical “Patatas Bravas” :wink:

Forget my problem with CastException. Finally worked. Actual problem is the size of bundle tables.

The migration process started and we have calculated it will finish in 34 days aprox !!!

So, if you know anything that could help us to decrease the size of this tables we would appreciate a lot.

You likely need to clean up your version history.

Thank you I will do.

Hi,

We have deployed Bloomreach-14.5.0 on our gcp cloud as K8S services, I follwed the same above step rather than cms version change to 15.x. I used below two details in context.xml one after.

But when app starts we face below issue and my app does not connect with mysql.

Can you help me the complete configuration that will help me to run on cloud with dynamic env variables?(like “@mysql.host@:@mysql.port@/@mysql.repo.db@”)

This sounds like a missing dependency for mysql. Do you have something like this in your root pom.xml?

<dependency>
  <groupId>com.mysql</groupId>
  <artifactId>mysql-connector-j</artifactId>
  <version>8.0.32</version>
  <scope>provided</scope>
</dependency>

Hi David,
Thanks for speedy reply, yes, I have added below dependency.

<dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <!-- <version>${mysql.connector.version}</version> -->
      <scope>provided</scope>
    </dependency>

Since above has mentioned inside hippo-cms7-release-14.5.0 version like below.

image

I think if I use mysql-connector-j there might be a conflict. Please correct me and let me know for any other details.

They changed the dependency name in 8.0.31, so yours should be fine as is https://blogs.oracle.com/mysql/post/mysql-connectorj-has-new-maven-coordinates

You could try setting the driver to “com.mysql.cj.jdbc.Driver” as it was renamed at some point.

How are you building your docker image? Are you using our docker file that’s documented in Run and Develop with Docker - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS or your own?

In any case you need to check if the mysql jars are included within the image

Hi David,
I am using CMS given docker only with below command " mvn clean install ; mvn -P docker.build, but have not called mysql profile. Can you please share your docker command?. Apart from this for H2 data base we had used REPO_PATH=${docker.brxm.project.path}/target/storage, in case of mysql what would be REPO_PATH?

Please read the “Docker DB Profiles” section carefully in the above documentation. The “docker.mysql” profile will launch a mysql container in the same Docker and connect the CMS to it. The “mysql” profile will connect to an external MySQL, with the defaults found in src/main/docker/Dockerfile

image

You can override these defaults by passing in environment variables with your desired config, when launching the docker image.

The REPO_PATH can be left as is but can also be overwritten, the default is also in the Dockerfile.

Thanks @David, finally I connected with one of my database(mydb) and not loosing my data after new builds or scale up/down. Now I am trying to connect with another database(X) since I am reading data from env specific config file so can change on the fly, if I do that and after scale down/up I get below error, now it is expecting some tables, mean to say that at run time not creating any tables.