Search code examples
quartz-scheduleroracle12cclassnotfoundexceptionwebsphere-libertyopen-liberty

Quartz 1.8.5 + OpenLiberty 18.0.0.4/ Websphere Liberty 17.0.0.4 java.lang.NoClassDefFoundError: oracle/sql/BLOB


we get the following exception when using quartz 1.8.5 and the liberty server. While using a tomcat-server (7.0.81) the exception doesn't occur.

java.lang.NoClassDefFoundError: oracle/sql/BLOB
at org.quartz.impl.jdbcjobstore.oracle.OracleDelegate.writeDataToBlob(OracleDelegate.java:642)
at org.quartz.impl.jdbcjobstore.oracle.OracleDelegate.insertJobDetail(OracleDelegate.java:207)

pom.xml

<dependency>
    <groupId>org.quartz-scheduler</groupId>
    <artifactId>quartz</artifactId>
    <version>1.8.5</version>
</dependency>       
<dependency>
    <!-- ASYNC-METHOD-INVOCATION -->
    <groupId>org.quartz-scheduler</groupId>
    <artifactId>quartz-oracle</artifactId>
    <version>1.8.5</version>
</dependency>
<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc6</artifactId>
    <version>12.1.0.2.0</version>
    <scope>provided</scope>
</dependency>

dataSource

<server>
  <library id="oracleDriver">
        <fileset dir="..\sw\oracle" includes="*.jar" scanInterval="120s" />
  </library>
  <!-- xa datasource -->
  <dataSource id="ORACLE_DS_XA" jndiName="jdbc/xxx/xxx" pool-name="xxx">
    <jdbcDriver libraryRef="oracleDriver" javax.sql.ConnectionPoolDataSource="oracle.jdbc.xa.client.OracleXADataSource" />
    <properties.oracle URL="jdbc:oracle:thin:@localhost:1521:sid" password="user" user="password" />
    <connectionManager minPoolSize="1" maxPoolSize="10" />
  </dataSource>
  <keyStore id="defaultKeyStore" password="password" />    
</server>

What could be the reason for that exception? And how can we solve the problem? Tell me if i should provide more information about our configuration.

TIA


Solution

  • I'm not really familiar with either, but if quartz is bundled in your application and needs access to the classes from your Oracle driver, then you need to expose the shared library to your application.

    You'd do this by adding a <classloader> section to your <application> or <webapplication> block in your server.xml

    E.g.

    <application ...rest of your app configuration...>
       <classloader commonLibraryRef="oracleDriver"/>
    </application>
    

    If you're currently deploying your app by putting it in the dropins directory, you'll have to change that to deploy your application to the apps directory instead and create an <application> or <webApplication> block in your server.xml.

    Documentation links:
    Deploying an app and adding the server.xml configuration
    Reference for <application> element (includes classloader as a sub-element)
    Reference for <webApplication> element (includes classloader as a sub-element)