22 February 2018

CNFE Quartz Job

A common problem is to a CNFE when a different job try to execute a job that is not is its classpath. This happens when different jobs are using the same quartz schema. This issue can be fixed by using different tables for Quartz persistence:

org.quartz.jobStore.tablePrefix = QRTZ_


Or to use different schedule name:

 <property name="schedulerName" value="quartzScheduler"/>

This can be checked in the column: SCHED_NAME of QRTZ_JOB_DETAILS.
Check the JOB_NAME column that contains the FQDN class

####<Feb 1, 2018 11:54:52 PM CLT> <Notice> <Stdout> <server> <WLSServer01> <QuartzScheduler_quartzScheduler-1517345673963_MisfireHandler> <<WLS Kernel>> <> <> <1517540092414> <BEA-000000> <23:54:52.413 [QuartzScheduler_quartzScheduler-1517345673963_MisfireHandler] ERROR org.springframework.scheduling.quartz.LocalDataSourceJobStore - MisfireHandler: Error handling misfires: Couldn't store trigger 'DEFAULT.cronTriggerNotificaSolicitud' for 'DEFAULT.complexJobDetailNotificaSolicitud' job:cl.devweb.aviso.cron.ExecuteNotificaSolicitud
org.quartz.JobPersistenceException: Couldn't store trigger 'DEFAULT.cronTriggerNotificaSolicitud' for 'DEFAULT.complexJobDetailNotificaSolicitud' job:cl.devweb.aviso.cron.ExecuteNotificaSolicitud
  at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeTrigger(JobStoreSupport.java:1223) ~[quartz-2.2.1.jar:?]
  at org.quartz.impl.jdbcjobstore.JobStoreSupport.doUpdateOfMisfiredTrigger(JobStoreSupport.java:1037) ~[quartz-2.2.1.jar:?]
  at org.quartz.impl.jdbcjobstore.JobStoreSupport.recoverMisfiredJobs(JobStoreSupport.java:986) ~[quartz-2.2.1.jar:?]
  at org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStoreSupport.java:3187) ~[quartz-2.2.1.jar:?]
  at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.manage(JobStoreSupport.java:3935) [quartz-2.2.1.jar:?]
  at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.run(JobStoreSupport.java:3956) [quartz-2.2.1.jar:?]
Caused by: java.lang.ClassNotFoundException: cl.devweb.aviso.cron.ExecuteNotificaSolicitud
  at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:357) ~[weblogic.server.merged.jar:12.1.3.0.0]
  at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:318) ~[weblogic.server.merged.jar:12.1.3.0.0]
  at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:80) ~[weblogic.server.merged.jar:12.1.3.0.0]
  at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[?:1.7.0_91]
  at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[?:1.7.0_91]
  at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:186) ~[weblogic.server.merged.jar:12.1.3.0.0]
  at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:50) ~[weblogic.server.merged.jar:12.1.3.0.0]
  at org.springframework.scheduling.quartz.ResourceLoaderClassLoadHelper.loadClass(ResourceLoaderClassLoadHelper.java:78) ~[spring-context-support-4.2.1.RELEASE.jar:4.2.1.RELEASE]
  at org.springframework.scheduling.quartz.ResourceLoaderClassLoadHelper.loadClass(ResourceLoaderClassLoadHelper.java:83) ~[spring-context-support-4.2.1.RELEASE.jar:4.2.1.RELEASE]
  at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectJobDetail(StdJDBCDelegate.java:852) ~[quartz-2.2.1.jar:?]
  at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeTrigger(JobStoreSupport.java:1205) ~[quartz-2.2.1.jar:?]
  ... 5 more>

More info: http://forums.terracotta.org/forums/posts/list/7073.page

31 January 2018

JDBC Statement Timeout


To enable this feature, go to Admin Console -> JDBC Data Source: Configuration: Connection Pool, and set "Statement Timeout" greater than 0.
            stmt = conn.createStatement();
            stmt.setQueryTimeout(1);
            // java.sql.Statement.setQueryTimeout();

java.sql.SQLException: ORA-01013: user requested cancel of current operation to the server log.


02 January 2018

Quartz Race Condition (in a cluster)

There is race condition (ABA problem)  when using Quartz cluster.
This may be translate in the below stacktrace:

For a strategy coding should not happen, however under certain circumstances, it does. (in particular WebLogic & Oracle DB)

The workaround is to set the following property:
org.quartz.jobStore.acquireTriggersWithinLock=true

As established in the official documentation it shouldn't be necessary:

org.quartz.jobStore.acquireTriggersWithinLock
Whether or not the acquisition of next triggers to fire should occur within an explicit database lock. This was once necessary (in previous versions of Quartz) to avoid dead-locks with particular databases, but is no longer considered necessary, hence the default value is “false”.


27-dic-2017 12h04=""  [See nested exception: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: restricción única (USERS.QRTZ_TRIGGERS_PK) violada
].
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler' defined in ServletContext resource [/WEB-INF/spring/root-context.xml]: Invocation of init method failed; nested exception is org.quartz.JobPersistenceException: Couldn't store trigger 'DEFAULT.cronTriggerUserNotificacion' for 'DEFAULT.complexJobDetailUserNotificacion' job:ORA-00001: restricción única (USERS.QRTZ_TRIGGERS_PK) violada
 [See nested exception: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: restricción única (USERS.QRTZ_TRIGGERS_PK) violada
]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    Truncated. see log file for complete stacktrace

21 December 2017

Garbage Collector incompatibilities

Garbage Collector incompatibilities

Conflicting collector combinations in option list; please refer to the release notes for the combinations allowed

I got the above error message after upgrading Eclipse Oxygen.

This is for GC options:

-XX:+UseParallelGC
# -XX:+UseG1GC

We cannot use both Garbage Collector at the same time... at least in this new version 4.7.2

https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/collectors.html

Blog Archive

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.