During data load phase of imports from MySQL or MariaDB servers fail with the following error message on ServiceNow instance user interface:
java.lang.NoClassDefFoundError: Could not initialize class org.mariadb.jdbc.internal.util.PidFactory$CLibrary
and the following error message and the stack trace exist before the above error message in agent.log of MID Server which is deployed on a Linux server:
2020-03-13 06:09:54 (390) Worker-Standard:JDBCProbe-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx SEVERE *** ERROR *** java.lang.UnsatisfiedLinkError: /tmp/jna-3506402/jna7843338838921309827.tmp: /tmp/jna-3506402/jna7843338838921309827.tmp: failed to map segment from shared object: Operation not permitted
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
Release or Environment
Madrid and onwards.
A new version of MariaDB JDBC driver is bundled with the MID Servers for Madrid and onwards releases. This driver's implementation is different than the previous releases and it tries to invoke a native Operating System (OS) library call while initializing connection to the DB Server.
The OpenJDK distributed with MID Server is making use of the OS designated temporary file directory (typically
/tmp) while making this native call, and the Linux system may be configured to restrict code executions from this directory for security reasons. Typically this will be a mount point with a flag of
For example from the example stack trace, we can see the temporary folder is
/tmp and when we check the contents of the
/etc/fstab file we may see the flag for
NOEXEC like the following line:
/dev/mapper/volgroup1-tmp /tmp xfs rw,nodev,
noexec,nosuid 0 0
In order to overcome this restriction, you will need to redirect OpenJDK (Java VM) to a different directory for temporary file creation and execution. Please follow the below steps:
- Login to your Linux host where you have deployed the MID Server
- Switch to the MID Server home directory (typically the directory named
- Create a folder with the name of
tmpwith the command:
- Switch to the wrapper configuration folder with the following command:
wrapper-override.conffile with a text editor like
picoand add the following to the bottom of the file:
Notice that the number
299should be unique and there shouldn't be any other line with the wrapper.java.additional.299 parameter. If there is any other, please use a different number higher than
- Save the file and restart your MID Server.
Next time you invoke a JDBC data load against a MySQL or MariaDB database, MID Server OpenJDK will use the new folder for the execution of OS native calls.