Difference between revisions of "Upgrading to Version 11.4"

From FMR Knowledge Base
Jump to navigation Jump to search
(Preparing to run Version 11.4 or later)
(Important Information for Registries using MySQL Database)
 
(31 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=IMPORTANT=
+
[[Category:How_To V11]]
If you are using an earlier version of FMR, you will need to make a key change in order to successfully start your Tomcat after installing Version 11.4 or later.
+
=Important Information for Registries using MySQL Database=
 +
From version 11.4.0 onwards, the Fusion Metadata Registry will '''no longer''' ship with a MySQL connector due to licensing issues.  FMR can still be used with a MySQL database, but you will need to manually supply the MySQL dependency JAR file. If you were using MySQL with an earlier version of FMR, then you will need to make this change in order to successfully start your Tomcat after installing Version 11.4 or later.  If you do not supply this dependency then you will receive a "ClassNotFoundException: com.mysql.cj.jdbc.Driver" error when attempting to start FMR and communicate with a MySQL database.
  
 
==Upgrading from Version 10 or earlier==
 
==Upgrading from Version 10 or earlier==
  
# Folow the Backing Up instructions in this article [[Upgrading_from_Version_10_to_Version_11|Upgrading from Version 10 to Version 11]].
+
# Follow the Backing Up instructions in this article [[Upgrading_from_Version_10_to_Version_11|Upgrading from Version 10 to Version 11]].
# Next, follow the instructions below.
+
# Follow the instructions below.
  
=Preparing to run Version 11.4 or later=
+
=Adding the MySQL Connector Dependency=
FMR supports mySql however the 'jar' file is not included as part of the software distribution so must be obtained and installed seperately prior to starting the application.
+
To get FMR version 11.4.0 or later, to communicate succesfully with a MySQL database, there are two tasks to perform:
 +
# Obtain the correct dependency file
 +
# Supply this to your Java Web Server (e.g. Tomcat) that you are using to run the Registry.
  
==Obtain the mySql connector==
+
==Obtaining the MySql Connector Dependency==
The file required can be obtained from the MySQL Developer Zone. At the time of writing this article [https://dev.mysql.com/downloads/connector/j/|this link will take you to the appropriate page.]
+
To enable FMR and a MySQL database to communicate the depdendency '''MySQL Connector/J''' version 8.0.29 (or higher) is required. This is a Jar file of approximately 2.5 Mb in size and called: '''mysql-connector-java-8.0.29.jar'''
  
From the dropdown list, select Platform Independent as shown in the image below.
+
This jar can be obtained from the MySQL Web site. At the time of writing this article [https://dev.mysql.com/downloads/connector/j/ this link will take you to the appropriate page] or alternatively you can obtain it from [https://mvnrepository.com/artifact/mysql/mysql-connector-java/8.0.30 Maven Central].
 +
 
 +
=== Obtaining the Jar file from the MySQL website ===
 +
 
 +
From the dropdown list, select ''''Platform Independen'''t' as shown in the image below and then select which type of compressed file you would like to downlaod.
 +
 
 +
These instructions are based on downloading the Zip file.
  
 
[[File:Download Connector.PNG|Download Connector|600px]]<br>
 
[[File:Download Connector.PNG|Download Connector|600px]]<br>
  
 +
If you are prompted as shown below, there is no need to Login or Sign Up, simply click on ''''No thanks'''' to download the relevant files.
 +
 +
[[File:Download Connector Confirm.PNG|600px]]<br>
 +
 +
 +
Once the zip file has been downloaded you need to unzip it in the usual way to a folder which will always be available to the application.
 +
 +
 +
Extracting the files:
 +
 +
[[File:Extract SQL Connector.PNG|600px]]<br>
 +
 +
In this example, I have downloaded the files to a sub folder on my C drive as shown below.
 +
 +
[[File:SQL Connector Target.PNG|300px]]<br>
 +
 +
Make a note of the full location path (including the file name) for the 'jar' file, in this example: ''''C:\SQL_Connector\mysql-connector-java-8.0.30\mysql-connector-java-8.0.30.jar''''.
 +
 +
[[File:Jar file location.PNG|600px]]<br>
 +
 +
==Providing the JAR file to your Java Web Server==
 +
There are a number of ways that the JAR file can be supplied to your Web Server and these ways will depend on the Web Server you are using.  We recommend the use of Apache Tomcat since it is quick and easy to configure.
 +
 +
For Apache Tomcat, the jar file can be added to the "lib" folder of the Tomcat instance.  The jar could also be added to the WEB-INF\lib folder of FMR once FMR has been expanded under the "webapps" directory (this method is not recommended as the file is lost when the Registry is upgraded). Another method is to specify the jar via the "setenv" file which allows the setting of environment variables at Tomcat launch-time.
 +
 +
===Specifying via setenv===
 +
setenv.bat (or setenv.sh for UNIX) is located in the Tomcat's bin folder.  If the file does not exist simply create it.
 +
 +
In setenv, add the location of the mysql-connector jar file to the CLASSPATH.  This can be achieved by use of the following line (which uses a location from the example above):
 +
 +
set CLASSPATH=C:\SQL_Connector\mysql-connector-java-8.0.30\mysql-connector-java-8.0.30.jar
 +
 +
==Troubleshooting==
 +
If FMR fails to start, inspect the Web Server logs.  If you encounter the following error:
  
 +
<pre>
 +
2022-09-30 23:59:59.999 WARN main org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator - HHH000342: Could not obtain connection to query metadata
 +
java.sql.SQLException: Cannot load JDBC driver class 'com.mysql.cj.jdbc.Driver'
 +
at org.apache.commons.dbcp2.DriverFactory.createDriver(DriverFactory.java:54)
 +
at org.apache.commons.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:459)
 +
at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:525)
 +
        ...
 +
Caused by: java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver
 +
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1407)
 +
        ...
 +
</pre>
  
==Change setenv.bat==
+
This means that the JAR file has not been supplied correctly to your Web Server.  Please review the steps you took in supplying the jar file to your Web Server and ensure that all locations and file names have been correctly specified.

Latest revision as of 00:34, 14 October 2022

Important Information for Registries using MySQL Database

From version 11.4.0 onwards, the Fusion Metadata Registry will no longer ship with a MySQL connector due to licensing issues. FMR can still be used with a MySQL database, but you will need to manually supply the MySQL dependency JAR file. If you were using MySQL with an earlier version of FMR, then you will need to make this change in order to successfully start your Tomcat after installing Version 11.4 or later. If you do not supply this dependency then you will receive a "ClassNotFoundException: com.mysql.cj.jdbc.Driver" error when attempting to start FMR and communicate with a MySQL database.

Upgrading from Version 10 or earlier

  1. Follow the Backing Up instructions in this article Upgrading from Version 10 to Version 11.
  2. Follow the instructions below.

Adding the MySQL Connector Dependency

To get FMR version 11.4.0 or later, to communicate succesfully with a MySQL database, there are two tasks to perform:

  1. Obtain the correct dependency file
  2. Supply this to your Java Web Server (e.g. Tomcat) that you are using to run the Registry.

Obtaining the MySql Connector Dependency

To enable FMR and a MySQL database to communicate the depdendency MySQL Connector/J version 8.0.29 (or higher) is required. This is a Jar file of approximately 2.5 Mb in size and called: mysql-connector-java-8.0.29.jar

This jar can be obtained from the MySQL Web site. At the time of writing this article this link will take you to the appropriate page or alternatively you can obtain it from Maven Central.

Obtaining the Jar file from the MySQL website

From the dropdown list, select 'Platform Independent' as shown in the image below and then select which type of compressed file you would like to downlaod.

These instructions are based on downloading the Zip file.

Download Connector

If you are prompted as shown below, there is no need to Login or Sign Up, simply click on 'No thanks' to download the relevant files.

Download Connector Confirm.PNG


Once the zip file has been downloaded you need to unzip it in the usual way to a folder which will always be available to the application.


Extracting the files:

Extract SQL Connector.PNG

In this example, I have downloaded the files to a sub folder on my C drive as shown below.

SQL Connector Target.PNG

Make a note of the full location path (including the file name) for the 'jar' file, in this example: 'C:\SQL_Connector\mysql-connector-java-8.0.30\mysql-connector-java-8.0.30.jar'.

Jar file location.PNG

Providing the JAR file to your Java Web Server

There are a number of ways that the JAR file can be supplied to your Web Server and these ways will depend on the Web Server you are using. We recommend the use of Apache Tomcat since it is quick and easy to configure.

For Apache Tomcat, the jar file can be added to the "lib" folder of the Tomcat instance. The jar could also be added to the WEB-INF\lib folder of FMR once FMR has been expanded under the "webapps" directory (this method is not recommended as the file is lost when the Registry is upgraded). Another method is to specify the jar via the "setenv" file which allows the setting of environment variables at Tomcat launch-time.

Specifying via setenv

setenv.bat (or setenv.sh for UNIX) is located in the Tomcat's bin folder. If the file does not exist simply create it.

In setenv, add the location of the mysql-connector jar file to the CLASSPATH. This can be achieved by use of the following line (which uses a location from the example above):

set CLASSPATH=C:\SQL_Connector\mysql-connector-java-8.0.30\mysql-connector-java-8.0.30.jar

Troubleshooting

If FMR fails to start, inspect the Web Server logs. If you encounter the following error:

2022-09-30 23:59:59.999 WARN main org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator - HHH000342: Could not obtain connection to query metadata
java.sql.SQLException: Cannot load JDBC driver class 'com.mysql.cj.jdbc.Driver'
	at org.apache.commons.dbcp2.DriverFactory.createDriver(DriverFactory.java:54)
	at org.apache.commons.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:459)
	at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:525)
        ...
Caused by: java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1407)
        ...

This means that the JAR file has not been supplied correctly to your Web Server. Please review the steps you took in supplying the jar file to your Web Server and ensure that all locations and file names have been correctly specified.