War deployment ends on 404 when use mysql connector

Hi,

I did a tomcat9 .war deploy of camunda. The initial deployment is fine and I end on setup. But, when I configure the Mysql Connector the result is 404 on everything.

I add this to /var/lib/tomcat9/webapps/camunda/WEB-INF/applicationContext.xml

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" >
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://server.domain:3306/camunda_prod?autoReconnect=true&sendFractionalSeconds=false&serverTimezone=America/Mexico_City" />
    <property name="username" value="user" />
    <property name="password" value="password" />
    <property name="defaultAutoCommit" value="false" />
  </bean> 

And commented the h2 part. Also installed mysql-connector-java_8.0.25-1ubuntu20.04_all.deb. But isn’t work, try to copy mysql-connector-java-8.0.25.jar to this directories:

  • /var/lib/tomcat9/lib
  • /var/lib/tomcat9/webapps/camunda/WEB-INF/lib

Isn’t work either. Help, please.

Thanks in advance
Nomar

I solve the issue!
First, I think I had the wrong database declaration. Imitating the format of the one that exists in camunda, I remade the configuration.

From the documentacion example:

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" >
  <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  <property name="url" value="jdbc:mysql://server:3306/camunda_prod?sendFractionalSeconds=false&serverTimezone=America/Mexico_City" />
  <property name="username" value="cam_prod_user" />
  <property name="password" value="password" />
  <property name="defaultAutoCommit" value="false" />
</bean>

I remade to something like this:

<bean id="dataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
  <property name="targetDataSource">
    <bean class="org.apache.commons.dbcp.BasicDataSource">
      <property name="driverClassName" value="com.mysql.jdbc.Driver" />
      <property name="url" value="jdbc:mysql://server:3306/camunda_prod?autoReconnect=true&sendFractionalSeconds=false&serverTimezone=America/Mexico_City" />
      <property name="username" value="user" />
      <property name="password" value="password" />
      <property name="defaultAutoCommit" value="false" />
    </bean>
  </property>
</bean>

Then from the logs I get this message:

07-Sep-2021 17:18:43.054 SEVERE [main] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
	org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 23 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumbe
r: 23; columnNumber: 131; The reference to entity "serverTimezone" must end with the ';' delimiter.

And reading from here I escape the & to this:

<bean id="dataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
  <property name="targetDataSource">
    <bean class="org.apache.commons.dbcp.BasicDataSource">
      <property name="driverClassName" value="com.mysql.jdbc.Driver" />
      <property name="url" value="jdbc:mysql://server:3306/camunda_prod?autoReconnect=true&amp;sendFractionalSeconds=false&amp;serverTimezone=America/Mexico_City" />
      <property name="username" value="user" />
      <property name="password" value="password" />
      <property name="defaultAutoCommit" value="false" />
    </bean>
  </property>
</bean>

And WORKED!!! :laughing: :smiling_face_with_three_hearts: :upside_down_face: