SQLSyntaxErrorException: unexpected token: AS required: ( in statement

Hey all,

I have some issues with my task scheduler. Whenever I open the screen I get the following Exception:
Next to that I get the same exception every time I try to add an task.

Internal Exception: java.sql.SQLSyntaxErrorException: unexpected token: AS required: ( in statement [SELECT LIMIT ? ? ID AS a1, IS_ACTIVE AS a2, BEAN_NAME AS a3, CLASS_NAME AS a4, CRON AS a5, DEFINED_BY AS a6, DELETE_TS AS a7, DELETED_BY AS a8, DESCRIPTION AS a9, LAST_START_SERVER AS a10, LAST_START_TIME AS a11, LOG_FINISH AS a12, LOG_START AS a13, METHOD_NAME AS a14, METHOD_PARAMS AS a15, PERIOD AS a16, PERMITTED_SERVERS AS a17, SCHEDULING_TYPE AS a18, SCRIPT_NAME AS a19, IS_SINGLETON AS a20, START_DATE AS a21, START_DELAY AS a22, TIME_FRAME AS a23, TIMEOUT AS a24, USER_NAME AS a25 FROM SYS_SCHEDULED_TASK WHERE (DELETE_TS IS NULL) ORDER BY BEAN_NAME, METHOD_NAME]
Error Code: -5581

It might have been caused by wrongly removing/adding beans but I am not 100% sure about that.

I set the task scheduling property in my app properties to true as well but it did not change anything.

On further inspection of the App log file I found the same internal exception, after that I found the following few lines:

2019-04-11 11:49:22.660 INFO  [cuba_core_scheduler-3/app-core/admin] com.haulmont.cuba.core.app.scheduling.DbBasedCoordinator - Unable to acquire lock on tasks
2019-04-11 11:49:23.689 INFO  [cuba_core_scheduler-3/app-core/admin] com.haulmont.cuba.core.app.scheduling.DbBasedCoordinator - Unable to acquire lock on tasks
2019-04-11 11:49:24.662 INFO  [cuba_core_scheduler-2/app-core/admin] com.haulmont.cuba.core.app.scheduling.DbBasedCoordinator - Unable to acquire lock on tasks
2019-04-11 11:49:25.693 INFO  [cuba_core_scheduler-2/app-core/admin] com.haulmont.cuba.core.app.scheduling.DbBasedCoordinator - Unable to acquire lock on tasks
2019-04-11 11:49:26.662 INFO  [cuba_core_scheduler-5/app-core/admin] com.haulmont.cuba.core.app.scheduling.DbBasedCoordinator - Unable to acquire lock on tasks
2019-04-11 11:49:27.689 INFO  [cuba_core_scheduler-5/app-core/admin] com.haulmont.cuba.core.app.scheduling.DbBasedCoordinator - Unable to acquire lock on tasks
2019-04-11 11:49:28.693 INFO  [cuba_core_scheduler-5/app-core/admin] com.haulmont.cuba.core.app.scheduling.DbBasedCoordinator - Unable to acquire lock on tasks
2019-04-11 11:49:29.689 INFO  [cuba_core_scheduler-6/app-core/admin] com.haulmont.cuba.core.app.scheduling.DbBasedCoordinator - Unable to acquire lock on tasks

It seems like the tasks cannot be saved because the table cannot be locked, how can I possibly solve this?
As I said it might have been caused by Beans or Services since I was adding/removing these before. But I am not sure if the application was doing this as well before I created any beans or services.

I tried going back to previous versions through Git. And the same error occurred in all versions, but I am not 100% sure that all the changes from adding beans and services were version controlled.

Log files:
perfstat-ui.log (2.8 KB)
localhost_access_log.2019-04-11.txt (1.2 KB)
catalina.2019-04-11.log (3.8 KB)
localhost.2019-04-11.log (1.3 KB)
perfstat.log (1.6 KB)
app.log (44.5 KB)

Hi,

This is a known issue with Studio 9 and projects using HSQL: the CUBA scheduled tasks feature simply doesn’t work in this combination. See item 1 in the Release Notes.
We don’t recommend using HSQL for anything beyond prototyping, but if it is a critical requirement for you, roll back to the previous Studio version, set HSQL version in build.gradle to 2.2.9 and wait for CUBA 7.1 which will rename the column, so you will be able to use the latest Studio again.

1 Like

Thank you for the reply! I thought I messed something up in my project.

Is it possible to port this change to 6.10.x? My customer is still using IE9 and a few desktop apps need HSQLDB to store information.

Could you elaborate? I don’t get how IE9 and desktop apps relate…

Sorry for confusing :sweat:. According to this release note, IE8-10 is not supported anymore which means I still have to use CUBA6.10.x at least this year as my client is asking to use IE9 (they have every old legacy system which depends on IE9). If you don’t have any plan to change the field name in CUBA 6.10.x, I have to stuck with plugin 8. I’m not asking you to fix this for me, however I’m wondering if I can upgrade this plugin in future.

But why are you using HSQL in the real project?
Anyway, if you need the old HSQL in the new Studio, try to downgrade it manually. The release notes now contains an instruction for this.

Thanks a lot.
For HSQL, I use NEO4J as main datasource for some business purposes, so I store nothing but some scheduled tasks in HSQL. I don’t want to apply a new database in our customer’s environment for for just some scheduled task records.
Anyhow, I know what to do next.

Thanks again for your time.