JS action based quartz job in Alfresco 6.2 not scheduling

cancel
Showing results for 
Search instead for 
Did you mean: 
cesarista
Customer

JS action based quartz job in Alfresco 6.2 not scheduling

Hi Alfresco people!

After some time missing, I'm migrating some of the our old (zylk) addons to Alfresco 6.2. In some of them, I used a JS based action script for quartz jobs like the following:

https://github.com/zylklab/zk-qshared-effectivity/blob/master/zk-qshared-effectivity-repo/src/main/a...

I can deploy this AMP in Alfresco repository with no errors, but I can not see the corresponding job in Admin Console, even I can not run it with JS Console like in Alfresco 5.2. It seems that the job is not correctly registered and not working., or/and JS snipplet for testing / running jobs is not working.

I read that quartz libraries and spring definitions have changed in Alfresco 6.2 with respect to previous versions.

Do you know if this kind of simple quartz jobs are possible in Alfresco 6.2 ? Or maybe, do you know a template for this kind of definition ? 

Kind regards and thanks in advance.

--C.

6 Replies
afaust
Master

Re: JS action based quartz job in Alfresco 6.2 not scheduling

I have such actions in a customer installation I only recently helped upgrade from 5.2 to 6.2, and those are scheduled & run appropriately (just yesterday I received an error report from testing due to a missing service reference to the dictionary service). Your configuration looks to be ok with regards to how the actions register themselves (via the Spring lifecycle interface InitialisingBean based on the configured scheduler property). Have you enabled debugging on the org.alfresco.repo.action.scheduled.AbstractScheduledAction logger to see what happens during the bean post-instantiation initialisation?

cesarista
Customer

Re: JS action based quartz job in Alfresco 6.2 not scheduling

Thanks Axel to point me for inspecting logs deeper.
I found an ERROR in the execution of the job, so it seems the scheduler was registered, although I can not see the job in the Scheduled Jobs section of the Admin console, as I expected.
 
The error was related to this:

2021-07-24 05:00:01,415 ERROR [org.quartz.core.JobRunShell] [DefaultScheduler_Worker-4] Job ZYLK.gdaExpirationJobDetail threw an unhandled Exception:

  org.alfresco.service.cmr.security.NoSuchPersonException: 062431728 User does not exist and could not be created: System


So I changed System by admin in the definition, and the job started to work. I don't really know why System user is not valid, while it was in Alfresco 5.2.

By the way, when I tried to test / run the quartz via JS console I obtained the following error, so this seems not valid for Alfresco 6.2.  

https://github.com/zylklab/zk-qshared-effectivity/blob/master/zk-qshared-effectivity-repo/src/main/a...

 

2021-09-28 18:40:36,046 ERROR [org.springframework.extensions.webscripts.AbstractRuntime] [http-nio-8080-exec-4] Exception from executeScript: 08280001 Wrapped Exception (with status template): 08280016 Failed to execute script 'Javascript Console Script': 08280015 Can't find method org.quartz.impl.StdScheduler.triggerJob(string,string). (Javascript Console Script#12)
org.springframework.extensions.webscripts.WebScriptException: 08280001 Wrapped Exception (with status template): 08280016 Failed to execute script 'Javascript Console Script': 08280015 Can't find method org.quartz.impl.StdScheduler.triggerJob(string,string). (Javascript Console Script#12)
        at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1139)
        at de.fme.jsconsole.ExecuteWebscript.executeScriptContent(ExecuteWebscript.java:252)
        at de.fme.jsconsole.ExecuteWebscript.access$100(ExecuteWebscript.java:51)
        at de.fme.jsconsole.ExecuteWebscript$2.execute(ExecuteWebscript.java:139)
        at de.fme.jsconsole.ExecuteWebscript$2.execute(ExecuteWebscript.java:137)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:450)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:338)
        at de.fme.jsconsole.ExecuteWebscript.runWithTransactionIfNeeded(ExecuteWebscript.java:136)
        at de.fme.jsconsole.ExecuteWebscript.access$000(ExecuteWebscript.java:51)
        at de.fme.jsconsole.ExecuteWebscript$1.doWork(ExecuteWebscript.java:124)
        at de.fme.jsconsole.ExecuteWebscript$1.doWork(ExecuteWebscript.java:122)
        at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:602)
        at de.fme.jsconsole.ExecuteWebscript.runScriptWithTransactionAndAuthentication(ExecuteWebscript.java:122)
        at de.fme.jsconsole.ExecuteWebscript.execute(ExecuteWebscript.java:92)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:474)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:664)
        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:435)
        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:315)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:399)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:210)
        at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)
        at org.alfresco.repo.web.scripts.AlfrescoWebScriptServlet.service(AlfrescoWebScriptServlet.java:43)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.alfresco.web.app.servlet.ServletMetricsFilter.doFilter(ServletMetricsFilter.java:161)
        at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:89)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:53)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.alfresco.web.app.servlet.ClearSecurityContextFilter.doFilter(ClearSecurityContextFilter.java:53)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.alfresco.scripts.ScriptException: 08280016 Failed to execute script 'Javascript Console Script': 08280015 Can't find method org.quartz.impl.StdScheduler.triggerJob(string,string). (Javascript Console Script#12)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:214)
        at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:219)
        at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:181)
        at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:109)
        at de.fme.jsconsole.ExecuteWebscript.executeScriptContent(ExecuteWebscript.java:201)
        ... 52 more
Caused by: org.alfresco.error.AlfrescoRuntimeException: 08280015 Can't find method org.quartz.impl.StdScheduler.triggerJob(string,string). (Javascript Console Script#12)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:537)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:210)
        ... 56 more
Caused by: org.mozilla.javascript.EvaluatorException: Can't find method org.quartz.impl.StdScheduler.triggerJob(string,string). (Javascript Console Script#12)
        at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:79)
        at org.mozilla.javascript.Context.reportRuntimeError(Context.java:1011)
        at org.mozilla.javascript.Context.reportRuntimeError(Context.java:1064)
        at org.mozilla.javascript.Context.reportRuntimeError1(Context.java:1027)
        at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:145)
        at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:55)
        at org.mozilla.javascript.gen.Javascript_Console_Script_10._c_script_0(Javascript Console Script:12)
        at org.mozilla.javascript.gen.Javascript_Console_Script_10.call(Javascript Console Script)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:412)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3545)
        at org.mozilla.javascript.gen.Javascript_Console_Script_10.call(Javascript Console Script)
        at org.mozilla.javascript.gen.Javascript_Console_Script_10.exec(Javascript Console Script)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:513)
        ... 57 more


Best regards.
--C.

abhinavmishra14
Advanced

Re: JS action based quartz job in Alfresco 6.2 not scheduling

We had the same issue when we upgraded from 5.2.7 to 6.2. We had a bunch of scheduled jobs that started to fail because of the same error you mentioned. We used org.alfresco.repo.security.authentication.AuthenticationUtil#runAsSystem(RunAsWork) in most jobs.

User does not exist and could not be created: System

There is no documentation whether "system" user is removed or no longer exists in and after 6.2. We did not get any clear details on this. runAsSystem method still exists by looking at latest git repo AuthenticationUtil#runAsSystem(RunAsWork) 

When we changed to run as "admin" user, all jobs started to work. We are living with it with no clues why "system" user causes the error. 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
cesarista
Customer

Re: JS action based quartz job in Alfresco 6.2 not scheduling

Thanks for the feedback Abhinav,

 - Do you see que defined job in Admin Console ? In Alfresco 5.2, they appear in the admin console with the option for running on demand, which it is quite useful for testing the job or other operational uses. I also used in some Alfresco versions the JS Console script for running the job on demand, but neither of them seems to be valid in 6.2. 

Regards.

--C.

abhinavmishra14
Advanced

Re: JS action based quartz job in Alfresco 6.2 not scheduling

Yeah, the jobs show in admin console. I can see them under Support Tools/scheduled-jobs and i can run them as well. 

It was showing earlier as well, it was failing to run because of system user and when we changes to admin it started to work.

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
ankitmodi89
Member II

Re: JS action based quartz job in Alfresco 6.2 not scheduling

@abhinavmishra14 can you help

 

Need immediate paid technical support for Alfresco community edition :

 

https://hub.alfresco.com/t5/alfresco-content-services-forum/how-to-access-alfresco-community-edition...