JMIX 1.2 - issues

Hi,

I got an app, which was migrated from cuba to jmix running now with the new 1.2 version.
We have been waiting for that because of the Quartz and Application Settings AddOn.

All 3 requested implementations in build.gradle are done,
quartz tables exist, the CUSTOMER_SETTINGS entity got created and the app is running fine.
But:
In the Administration menu there is no entry for Quartz Jobs
and in the Application Properties I only see this:
image

And, we still have the old Scheduled Tasks entry in the Administration part.

In the complete coding, there is no …cuba… import existing.

Question:
How to get this corrected?

Regards
Roland

Hi,

I’ve tried to reproduce the situation but it is working as expected :slight_smile:

Regarding Application settings add-on - it is available under “Application settings” menu and as I can see it is present in your “Administartion” menu. Have you try it?

Regarding Quartz add-on, it should be last in list of menu points -
image
Unfortunately, it is not clear from your screenshot is it missing or not; maybe do you have some custom menu config?
Could you please try to add into your menu.xml next row for quartz job screen in this case

<item screen="quartz_JobModel.browse" caption="Quartz Jobs"/>

Regards,
Artem

I only see the error:
quartz_JobModel.browse does not exist

additional information:
1.
after changing to the 1.2.0-RC1,
this entry in build.gradle did not get changed:
It still had version 1.4.1,
Changed it manually to 1.2.0-RC1
plugins {
id ‘io.jmix’ version ‘1.2.0-RC1’
id ‘java’
}

I took out this line in the build.gradle:
//implementation “io.jmix.cuba:jmix-cuba-starter”
After that all the old Administration menu entries disappeared.

I took out all quartz settings, put them in again, created manually the quartz tables…
everything works fine,
but the Quartz menu entry is still missing and also quartz_JobModel.browse cannot be found anywhere in the project scope.

Regards
Roland

additional information:
I took a JMIX app (not migrated from Cuba),
changed to version 1.2.RC1…
works fine.
Then I followed the manual how to setup Quartz with SQL server.
Here is the error I get, when starting the app:

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2022-03-02 15:28:07.177 ERROR 1608 — [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.context.ApplicationContextException: Failed to start bean ‘quartzScheduler’; nested exception is org.springframework.scheduling.SchedulingException: Could not start Quartz Scheduler; nested exception is org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR. [See nested exception: com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.]]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.15.jar:5.3.15]
at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_201]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.3.jar:2.6.3]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) [spring-boot-2.6.3.jar:2.6.3]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:414) [spring-boot-2.6.3.jar:2.6.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) [spring-boot-2.6.3.jar:2.6.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) [spring-boot-2.6.3.jar:2.6.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) [spring-boot-2.6.3.jar:2.6.3]
at com.jnj.dna.DnaApplication.main(DnaApplication.java:37) [main/:na]
Caused by: org.springframework.scheduling.SchedulingException: Could not start Quartz Scheduler; nested exception is org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR. [See nested exception: com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.]]
at org.springframework.scheduling.quartz.SchedulerFactoryBean.start(SchedulerFactoryBean.java:805) ~[spring-context-support-5.3.15.jar:5.3.15]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.15.jar:5.3.15]
… 14 common frames omitted
Caused by: org.quartz.SchedulerConfigException: Failure occured during job recovery.
at org.quartz.impl.jdbcjobstore.JobStoreSupport.schedulerStarted(JobStoreSupport.java:697) ~[quartz-2.3.2.jar:na]
at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:539) ~[quartz-2.3.2.jar:na]
at org.quartz.impl.StdScheduler.start(StdScheduler.java:142) ~[quartz-2.3.2.jar:na]
at org.springframework.scheduling.quartz.SchedulerFactoryBean.startScheduler(SchedulerFactoryBean.java:730) ~[spring-context-support-5.3.15.jar:5.3.15]
at org.springframework.scheduling.quartz.SchedulerFactoryBean.start(SchedulerFactoryBean.java:802) ~[spring-context-support-5.3.15.jar:5.3.15]
… 15 common frames omitted
Caused by: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.
at org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.executeSQL(StdRowLockSemaphore.java:184) ~[quartz-2.3.2.jar:na]
at org.quartz.impl.jdbcjobstore.DBSemaphore.obtainLock(DBSemaphore.java:113) ~[quartz-2.3.2.jar:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3857) ~[quartz-2.3.2.jar:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.recoverJobs(JobStoreSupport.java:839) ~[quartz-2.3.2.jar:na]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.schedulerStarted(JobStoreSupport.java:695) ~[quartz-2.3.2.jar:na]
… 19 common frames omitted
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:265) ~[mssql-jdbc-9.4.1.jre8.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1662) ~[mssql-jdbc-9.4.1.jre8.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:615) ~[mssql-jdbc-9.4.1.jre8.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:537) ~[mssql-jdbc-9.4.1.jre8.jar:na]
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7417) ~[mssql-jdbc-9.4.1.jre8.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:3488) ~[mssql-jdbc-9.4.1.jre8.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:262) ~[mssql-jdbc-9.4.1.jre8.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:237) ~[mssql-jdbc-9.4.1.jre8.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:456) ~[mssql-jdbc-9.4.1.jre8.jar:na]
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52) ~[HikariCP-4.0.3.jar:na]
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java) ~[HikariCP-4.0.3.jar:na]
at org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.executeSQL(StdRowLockSemaphore.java:123) ~[quartz-2.3.2.jar:na]
… 23 common frames omitted

Caused by: org.springframework.scheduling.SchedulingException: Could not start Quartz Scheduler; nested exception is org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR. [See nested exception: com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.]]

Caused by: org.quartz.SchedulerConfigException: Failure occured during job recovery.

Caused by: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.

Could you please provide your test project?

With which version of Jmix do you have before changing version?

Regards,
Artem

last version I could see in build.gradle: 1.1.4 (changed that manually to …RC1)

how to provide you the project, shall I zip it?

sent it to you as .zip via message

Hi!

I’ve used a project provided by you and did next changes:

  • changed data sources to my test Postgres instances
  • added dependencies for appsettings and quartz:
        implementation 'io.jmix.quartz:jmix-quartz-starter'
        implementation 'io.jmix.appsettings:jmix-appsettings-starter'
        implementation 'io.jmix.appsettings:jmix-appsettings-ui-starter' 

After I’ve launch a project and all add-ons are available
image

Note, that for quartz add-on you don’t need to create quartz tables by yourself, it is add-on responsibility. So, records in your application.properties

# scheduler
main.datasource.studio.liquibase.excludePrefixes = qrtz_
spring.quartz.job-store-type = jdbc
spring.quartz.jdbc.initialize-schema = never

not needed anymore.

Certainly, if there are already quartz tables, add-on will skip creating them and will provide UI in order to manage all existing jobs and triggers.

Regards,
Artem

1 Like

Hi,

that works…
I think the issue is caused by the wrong? documentation.
In the 1.2 doc you write to use:

  1. Add the following dependency to the build.gradle file:
    implementation ‘org.springframework.boot:spring-boot-starter-quartz’

After changing that to implementation ‘io.jmix.quartz:jmix-quartz-starter’ it worked fine.

Thx for the help…
maybe you should adjust the docu?

Regards
Roland

Currently in 1.2 documentation:


Since Jmix v.1.2, the recommended way to integrate Quartz Job Scheduler is to use the Quartz add-on.

This section is helpful only if you don’t use the Quartz add-on.

So it looks actual.