2

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

Jens B
  • 51
  • 5
  • Glad your problem was solved. Be careful using unmanaged threads in Liberty (if this is indeed what you're using via Quartz), as it can lead to a variety of issues. – Scott Kurz Aug 17 '18 at 13:25

1 Answers1

2

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)

Azquelt
  • 1,380
  • 10
  • 15
  • It worked! Just added the classloader with the reference to the library in the application part of our server.xml. Thank you. – Jens B Aug 16 '18 at 12:49