title: Getting java.lang.NoClassDefFoundError: Could not initialize class oracle.jdbc.OracleDriver exception
body: <p>I am seeing some weird behavior when attempting to access a database using JDBC drivers. Here's the code fragment:</p>
  
  <pre><code>LOGGER.debug("driver is " + driver);
  try {
      Class.forName(driver);
      LOGGER.debug("got driver");
  } catch (Throwable t) {
      LOGGER.debug("throwable getting driver " + driver);
      t.printStackTrace(System.out);
      throw t;
  }
  </code></pre>
  
  <p>When I run this, here's what I see in the stack trace.</p>
  
  <pre><code>08:20:00.417 [main] DEBUG - driver is com.sybase.jdbc4.jdbc.SybDriver
  08:20:00.604 [main] DEBUG - throwable getting driver com.sybase.jdbc4.jdbc.SybDriver
  java.lang.NoClassDefFoundError: Could not initialize class oracle.jdbc.OracleDriver
          at java.base/java.lang.Class.forName0(Native Method)
          at java.base/java.lang.Class.forName(Class.java:398)
          at java.sql/java.sql.DriverManager.isDriverAllowed(DriverManager.java:555)
          at java.sql/java.sql.DriverManager.isDriverAllowed(DriverManager.java:547)
          at java.sql/java.sql.DriverManager.getDrivers(DriverManager.java:449)
          at java.sql/java.sql.DriverManager.getDrivers(DriverManager.java:426)
          at com.sybase.jdbc4.jdbc.SybDriver.registerWithDriverManager(Unknown Source)
          at com.sybase.jdbc4.jdbc.SybDriver.&lt;init&gt;(Unknown Source)
          at com.sybase.jdbc4.jdbc.SybDriver.&lt;clinit&gt;(Unknown Source)
          at java.base/java.lang.Class.forName0(Native Method)
          at java.base/java.lang.Class.forName(Class.java:315)
          ... my code
  </code></pre>
  
  <p>So I can see that the driver name that I am trying to get is com.sybase.jdbc4.jdbc.SybDriver which is correct, but for some reason, the DriverManager is looking for oracle.jdbc.OracleDriver.</p>
  
  <p>What is going on? This code has been working well for years, and the only other relevant information I can think of is that I have recently upgraded the JDK on this machine to Open JDK 11.</p>
  
  <pre><code>&gt;java -version
  openjdk version "11.0.2" 2019-01-15
  OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
  OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
  </code></pre>