Oracle JDBC Driver Compatibility Issues

Last modified by superadmin on 2026/11/25 21:32

Hibernate or ORA-01400 errors come from an ojdbc JAR for the wrong Java version, or several of them, on the classpath.

Explanation

When starting XWiki with Oracle, or when saving a page for the first time, you may see a NullPointerException thrown from inside Hibernate's HqlSqlWalker class, or an Oracle error on a column XWiki fills in itself:

ORA-01400: cannot insert NULL into ("XWIKI"."XWIKILARGESTRINGS"."XWL_ID")

Cause

The Oracle JDBC driver on the XWiki classpath is not the right one, in one of two ways:

  • The JAR was picked for the wrong Java version. Oracle publishes one JAR per Java version and only the one matching the Java version XWiki runs on behaves correctly: ojdbc8.jar for Java 8, ojdbc11.jar for Java 11, and ojdbc17.jar for Java 17 and later, which is the JAR XWiki's own build and functional tests use.
  • Several ojdbc JARs are visible to the web application, typically one in its WEB-INF/lib directory and another in the servlet container's shared library directory. Which one is loaded then depends on the class loader, which is why the symptom can come and go between restarts.

The driver does not have to match the Oracle Database release, although that is what the error was long attributed to. Oracle certifies each supported driver release against every supported database release, as its version compatibility matrix shows. It does recommend a driver at least as recent as the database, so that the driver can use the database's newer capabilities.

Solution

  1. Look for ojdbc JAR files both in the XWiki web application's WEB-INF/lib directory and in the servlet container's shared library directory, and delete all of them.
  2. Check which Java version the servlet container runs on, and download the driver JAR for that version from Oracle's JDBC download page or from Maven Central.
  3. Copy that single JAR into one of the two directories, and restart the servlet container. XWiki starts and saves pages without the error.

FAQ

Does the XWiki WAR ship an Oracle JDBC driver?

No. Only XWiki's own functional tests pull one in, so the driver always has to be downloaded and copied in by hand, and copied again after an upgrade if it lives in the web application's WEB-INF/lib directory rather than in the servlet container's shared library directory.

Which JAR do I use on Java 25?

ojdbc17.jar, the newest JAR Oracle publishes: there is no ojdbc21 or ojdbc25. The Java support strategy lists the Java versions each XWiki release supports.

Related

Get Connected