1

I have a spring-boot app for quartz scheduler, that previously working fine with the default quartz datasource. But however after moved to use the JBOSS JNDI datasource, it hit exception on the BLOB columns, in the Oracle 12 database.

I have a customized REST API, which will call the quartz APIs to schedule a job. The app doesn't return much info about the exception neither in the error page nor the log4j debug log file.

Below is the error page about the exception:


enter image description here


There is no exception in my log4j log file.

What I have tried:

  1. Initially, I used the spring boot quartz starter. but now I have changed it to the SchedulerFactoryBean.
  2. The JBOSS JNDI datasource by itself seems fine, I have other features / functions using the same JNDI datasource and so far so good. But take note that those functions doesn't involve table with BLOB column.

Here is my previous quartz properties:

enter image description here

My current quartz properties:

enter image description here

My Current Quartz Configuration in the applicationContext-resources.xml:

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName">
        <value>${jdbc.jndiName}</value>
    </property>
</bean>

<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    <property name="dataSource">
        <ref bean="dataSource" />
    </property>
</bean>

<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" lazy-init="false">
    <property name="dataSource" ref="dataSource" />
    <property name="transactionManager" ref="transactionManager" />
    <property name="configLocation">
        <value>classpath:/quartz.properties</value>
    </property>
    <property name="autoStartup" value="true" />
    <property name="startupDelay" value="5" />
    <property name="waitForJobsToCompleteOnShutdown" value="true" />
    <!-- <property name="jobFactory">
        <bean class="com.novacitynets.fornax.schedulejob.integration.springquartz.AutowiringSpringBeanJobFactory">
            <property name="ignoredUnknownProperties" value="applicationContext"/>
        </bean>
    </property> -->
    <!-- <property name="jobSchedulingDataLocations">
        <list>
            <value>classpath:/quartz-jobs.xml</value>
        </list>
    </property> -->
</bean>

My current datasource configuration in the JBOSS standalone.xml:

    <subsystem xmlns="urn:jboss:domain:datasources:5.0">
        <datasources>
            <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
                <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                <driver>h2</driver>
                <security>
                    <user-name>sa</user-name>
                    <password>sa</password>
                </security>
            </datasource>
            <datasource jta="true" jndi-name="java:jboss/OracleDS" pool-name="OracleDS" enabled="true" use-ccm="true">
                <connection-url>jdbc:oracle:thin:@//10.0.2.234:1521/DAX2intra</connection-url>
                <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
                <driver>oracle</driver>
                <pool>
                    <min-pool-size>5</min-pool-size>
                    <max-pool-size>150</max-pool-size>
                </pool>
                <security>
                    <user-name>DAX2MGR</user-name>
                    <password>Nova#1234</password>
                </security>
                <validation>
                    <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
                    <background-validation>true</background-validation>
                    <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
                    <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
                </validation>
            </datasource>
            <drivers>
                <driver name="h2" module="com.h2database.h2">
                    <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                </driver>
                <driver name="oracle" module="com.oracle.jdbc">
                    <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
                </driver>
            </drivers>
        </datasources>
    </subsystem>

My module.xml configuration in the JBOSS:

<module xmlns="urn:jboss:module:1.1" name="com.oracle.jdbc">

    <resources>
        <resource-root path="ojdbc8-12.2.0.1.jar"/>
    </resources>

    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
</module>

And also, I have added this c3p0 dependency into my pom.xml, though not sure if this does matter.

John Wong
  • 125
  • 1
  • 1
  • 13
  • I think you _need_ to get the exception. Perhaps change the web settings so that the exception and the stack trace are not swallowed by the generic message. – fdreger May 07 '19 at 07:45

1 Answers1

0

Able to resolve the issue with below steps:

For JBOSS: 1. Include the dependency of oracle jdbc module, where this oracle jdbc module is a customized module in JBOSS for the ojdbc jar file.. 2. exclude the oracle ojdbc jar from pom.xml.

Refer to answer from quartz 2.2.1+jboss EAP 6.4 ClassNotFoundException oracle.sql.BLOB

For WebLogic 1. In the quartz properties config, set the org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.WebLogicDelegate 2. exclude the oracle ojdbc jar from pom.xml

John Wong
  • 125
  • 1
  • 1
  • 13