ImapSync Job getting auto created

Hi,

I had created multiple jobs and set cron expression to run automaticall.
But io.jmix.autoconfigure.imap.job.***ImapSync Job*** getting automatically created even after deleting the job from the table still somehow it is getting created and due to which job are getting in to paused state automatically once it gets fired. Also job are going from Waiting state to Error state instead of waiting state for next fire date and time. Also class is available as im able to create cron


ERROR o.q.i.j.JobStoreSupport.acquireNextTrigger:2867 - [quartzScheduler_QuartzSchedulerThread] Error retrieving job, setting trigger state to ERROR.
org.quartz.JobPersistenceException: Couldn't retrieve job because a required class was not found: com.mobicule.mcollectsettlementnew.scheduler.LoanCorePostingMc001
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveJob(JobStoreSupport.java:1393)

Hello,

which version of Jmix are you using for this?

Kind regards,
Mladen

id ‘io.jmix’ version ‘1.5.0’

OK, I did not use 1.x, because I went from CUBA 7.2 straight to Jmix 2.x , but I used IMAP add-on with CUBA so I have some thoughts.

  • getting automatically created - seems like the addon itself is doing this if it detects no such job is found, is it when the application starts?
  • why are you deleting it, I have one but I have made it inactive, because I don’t want the sync anymore - if it’s inactive, then I think that it would be left alone by the addon in the state that is presently in
  • I think the difference between CUBA IMAP and Jmix 1.x IMAP is a switch to quartz
  • with quartz addon, you specify a job and since you can create a job with a dropdown select of the class that is reported missing, it’s strange
    → I would try like this:
  1. Invalidate all caches, rebuild, and run your app
  2. delete job, restart, let IMAP add-on at its job, then set it inactive
  3. restart your app
    If there are errors, I would check what is in the database inside quartz-related tables, could be that during your experiments something was left while deleting so it’s interfering now

Kind regards,
Mladen

Hi,

I find out two instances are running had quartz plugin and both were simultaneously trying to execute the cron since instance does not had that cron class due to this scheduler state was going into ERROR
I had added parameter below parameter in instance one to avoid sharing instance.
spring.quartz.properties.org.quartz.jobStore.tablePrefix=qrtz1

This is working but i had query i had somehow added identifier and working fine for primary database.
But my secondary database must work as it is with default qrtz_ identifier on instance one.
Both database schema is different.

If several applications, or instances of the same, want to share the same quartz tables in one database, you can try to enable clustering for quartz in their configurations.

spring.quartz.properties.org.quartz.jobStore.isClustered=true
spring.quartz.properties.org.quartz.scheduler.instanceId=AUTO

Also each instance needs its own unique instance name
spring.quartz.properties.org.quartz.scheduler.instanceName=SchedulerInstance1

Is that your scenario?

Scenario is
Project 1 has 2 database configured, 1 main database and 2 additional database.
Project 2 has 1 database configured, 1 main

Both Projects main database is pointing to same database. Since both database contains qrtz_ plugins and table they are trying to execute the crons.
As project 1 does not has that class it marks the state as error.
I want Project 1 not to execute or run any crons even it has quartz plugin install as it should trigger from project 2 only.
Also Project 1 Additional database must work as it is executing Additional database crons. I want to restrict on database configuration level. At a time only instance(Project 1 or Project 2) can execute crons

I want Project 1 not to execute or run any crons even it has quartz plugin install as it should trigger from project 2 only.

How about this one:
spring.quartz.auto-startup=false
If you put that one into Project1 configuration, it will not execute itself.
I also think you should use spring profiles, so you can make different configurations for different scenarios. That way, you can start Project1 either with quartz execution upon start, or not.

Kind regards,
Mladen

1 Like

Thank you

Then what I wrote will not work.
Let us see if I understand correctly:
Project1 and Project2 share the same main datastore
Project2 quartz addon is executing jobs from the main datastore
Project1 quartz addon should not execute from the main datastore but from an additional datastore

It then follows that Project 1 configuration should point to additional datastore, like here

That way Project2 will look into main datastore, and Project1 would “ignore” quartz jobs stored in main datastore and would look for jobs in the additional datastore.