Tomcat setenv file

From FMR Knowledge Base
Revision as of 07:41, 17 April 2024 by Vmurrell (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Configuration for Fusion Metadata Registry is principally set by creating a setenv.bat or setenv.sh script in the Tomcat bin directory.

Below are examples for Windows and Linux.

Windows

tomcat\bin\setenv.bat

set "JAVA_OPTS=%JAVA_OPTS% -Xmx6G -server -DRegistryProperties=file:///C:/Tomcats/Environments/fusion_registry.properties"
set CLASSPATH=c:\oracle\ojdbc8.jar

Linux

tomcat/bin/setenv.sh
#!/bin/sh

export JAVA_OPTS="-Xmx6G -server -DRegistryProperties=file:\\opt\tomcats\environments\fusion_registry.properties"
export CLASSPATH="/opt/oracle/ojdbc8.jar"

CLASSPATH Settings for Oracle

The CLASSPATH environment variable tells the Java Virtual Machine where to look for additional classes.

If you want to use an Oracle database, you must download the JDBC driver directly from Oracle and reference the location of the jar by setting the CLASSPATH variable as illustrated in the example.

CLASSPATH=/home/oracle/jdbc/ojdbc8.jar

CLASSPATH Settings for MySQL

The following adds a specific location for a MySql connector jar file to the java Classpath:

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

JAVA_OPTS Configuration Parameters

JAVA_OPTS parameters configure the Java virtual machine, and also allow system parameters to be passed to the Fusion Metadata Registry application to alter its behaviour.

Parameter Purpose Example
-Xmx Sets the maximum amount of memory that can be allocated to the Java heap. This should be a minimum of 4GB and ideally about 75% of available memory on the machine. Setting too low may result in Java 'out of memory' errors. -Xmx4GB
sets the maximum heap size to 4GB
-Xms Sets the initial amount of memory to be allocated to the Java heap. When running in production, there may be a performance benefit to setting this to the same value as -Xmx which avoids the need to grow the heap as memory demand grows. -Xms128m
sets the initial heap to 128MB
-server Improves performance by optimising the way the Java Virtual Machine works.
-DRegistryProperties System Property: Sets a specific path for the Fusion Registry properties file. If not set, the default location is used -DRegistryProperties=file:\\opt\tomcats\environments\fusion_registry.properties
In Linux, sets the properties file location to the path specified.
-Djson.legacy.enabled=true
or
-Djson.legacy.enabled=false (default)
System Property: Sets whether the Fusion Registry instance uses the legacy Metadata Technology JSON dialect, or the official SDMX-JSON version 1.0 Structure and Data Exchange format.

By default, or if the property is explicity set to false, JSON returned will conform to the official SDMX-JSON specification when:

  • JSON is chosen as a format in the web user interface when exporting data or structures;
  • The HTTP 'Accept' header is set to 'application/vnd.sdmx.json' when making a REST web service call; or
  • The URL format parameter is set to 'sdmx-json' when making a REST web service call.

If the property to true, JSON returned will conform to Metadata Technology's legacy JSON format for structures and data. Use this for backward compatibility where existing client-side applications rely on the legacy JSON format.

-Djson.legacy.enabled=true
Force Fusion Registry to produce and accept structures and data in the legacy Metadata Technology dialect
-DLicenseFile= (Data Essentials only) Sets the location of the License file and the Public key which is used in Data Essentials. -DLicenseFile=file:///C:/tomcats/RegistryProperties/8080_LICENSE/fusionLicense.fl sets the location to a specific location on the C drive