Troubleshooting: Oracle JDBC driver error (java.lang.NullPointerException)

When using an Oracle database, and running the updatedb utility from the Utility server Docker container with the isStaging parameter specified, you can experience a NullPointerException error.

Problem

For Oracle database, the updatedb utility uses the legacy JDBC driver oracle.jdbc.driver.OracleDriver by default. This version of the driver is not compatible with the utility, which is designed to work with the new driver oracle.jdbc.OracleDriver. As a result, a NullPointerException error is thrown. This issue is experienced on an authoring Oracle database only.

The error displayed is similar to the following:
[stagingck] action=insert, tablename=WCS_Fixpack, serverOrToolkit=server, stagingServer=true, stagingDbChecked=false, logLevel=5
BUILD FAILED
/opt/WebSphere/CommerceServer90/components/common/xml/fixpack.xml:44: The following error occurred while executing this line:
/opt/WebSphere/CommerceServer90/components/common/xml/fixpack.xml:138: java.lang.NullPointerException
Caused by: java.lang.NullPointerException
at com.ibm.commerce.config.ant.tasks.BasicAntDbTask.execute(BasicAntDbTask.java:121)
at com.ibm.commerce.config.ant.tasks.CheckStagingDbTask.execute(CheckStagingDbTask.java:157)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)

Solution

To resolve the issue, specify the correct JDBC driver, oracle.jdbc.OracleDriver, using the jdbcDriver parameter.

For example:
./updatedb.sh -dbType dbType -dbName dbName -dbUserName dbUserName -dbUserPassword dbUserPassword -dbHostname dbHostname -dbServerPort dbServerPort -dbaName dbaName -dbaPassword dbaPassword -jdbcURL jdbcURL -jdbcDriver oracle.jdbc.OracleDriver -isStaging isStaging

The error will not occur.