DerivedDataFunction and scheduled publish

Hi,

We have a derived data function DerivedDataFunction which works as we intend for the most part. The class is defined in the cms module as per the documentation. However we have noticed that when the user schedules a publish an exception is thrown (see below).

This is deployed as in the ‘Clustering’ diagram on this page:

The exception appears in the log for the delivery server logs. It seems like maybe the scheduled job is running in the delivery tier and cannot find the derived data function? Any ideas what we might be doing wrong here?

Regards,

David

Execution of scheduled workflow operation publish on /content/documents/govscot/publications/transparency-data/2021/02/marketing-spend-2019-2020/index failed
org.hippoecm.repository.api.WorkflowException: No such function
at org.onehippo.repository.documentworkflow.task.AbstractDocumentTask.execute(AbstractDocumentTask.java:95) ~[hippo-repository-workflow-5.6.3.jar:5.6.3]
at org.onehippo.repository.scxml.AbstractWorkflowTaskAction.doExecute(AbstractWorkflowTaskAction.java:64) ~[hippo-repository-workflow-5.6.3.jar:5.6.3]
at org.onehippo.repository.scxml.AbstractAction.execute(AbstractAction.java:77) ~[hippo-repository-workflow-5.6.3.jar:5.6.3]
at org.apache.commons.scxml2.model.If.execute(If.java:144) ~[commons-scxml2-2.0-M1.jar:2.0-M1]
at org.apache.commons.scxml2.semantics.SCXMLSemanticsImpl.executeContent(SCXMLSemanticsImpl.java:925) ~[commons-scxml2-2.0-M1.jar:2.0-M1]
at org.apache.commons.scxml2.semantics.SCXMLSemanticsImpl.executeTransitionContent(SCXMLSemanticsImpl.java:911) ~[commons-scxml2-2.0-M1.jar:2.0-M1]
at org.apache.commons.scxml2.semantics.SCXMLSemanticsImpl.microStep(SCXMLSemanticsImpl.java:249) ~[commons-scxml2-2.0-M1.jar:2.0-M1]
at org.apache.commons.scxml2.semantics.SCXMLSemanticsImpl.nextStep(SCXMLSemanticsImpl.java:176) ~[commons-scxml2-2.0-M1.jar:2.0-M1]
at org.apache.commons.scxml2.SCXMLExecutor.eventStep(SCXMLExecutor.java:418) ~[commons-scxml2-2.0-M1.jar:2.0-M1]
at org.apache.commons.scxml2.SCXMLExecutor.triggerEvents(SCXMLExecutor.java:413) ~[commons-scxml2-2.0-M1.jar:2.0-M1]
at org.apache.commons.scxml2.SCXMLExecutor.triggerEvent(SCXMLExecutor.java:381) ~[commons-scxml2-2.0-M1.jar:2.0-M1]
at org.onehippo.repository.scxml.SCXMLWorkflowExecutor.triggerAction(SCXMLWorkflowExecutor.java:314) ~[hippo-repository-workflow-5.6.3.jar:5.6.3]
at org.onehippo.repository.scxml.SCXMLWorkflowExecutor.triggerAction(SCXMLWorkflowExecutor.java:278) ~[hippo-repository-workflow-5.6.3.jar:5.6.3]
at org.onehippo.repository.documentworkflow.DocumentWorkflowImpl.triggerAction(DocumentWorkflowImpl.java:464) ~[hippo-repository-workflow-5.6.3.jar:5.6.3]
at org.onehippo.repository.documentworkflow.DocumentWorkflowImpl.publishBranch(DocumentWorkflowImpl.java:433) ~[hippo-repository-workflow-5.6.3.jar:5.6.3]
at org.onehippo.repository.documentworkflow.DocumentWorkflowImpl.publish(DocumentWorkflowImpl.java:314) ~[hippo-repository-workflow-5.6.3.jar:5.6.3]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_222]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_222]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]
at org.hippoecm.repository.impl.WorkflowManagerImpl$WorkflowInvocationHandler.invoke(WorkflowManagerImpl.java:373) ~[hippo-repository-engine-5.6.3.jar:5.6.3]
at com.sun.proxy.$Proxy122.publish(Unknown Source) ~[?:?]
at org.onehippo.repository.documentworkflow.task.ScheduleWorkflowTask$WorkflowJob.execute(ScheduleWorkflowTask.java:129) [hippo-repository-workflow-5.6.3.jar:5.6.3]
at org.hippoecm.repository.quartz.RepositoryJobJob.execute(RepositoryJobJob.java:50) [hippo-repository-engine-5.6.3.jar:5.6.3]
at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-2.2.1.jar:?]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.2.1.jar:?]
Caused by: javax.jcr.RepositoryException: No such function
at org.hippoecm.repository.deriveddata.DerivedDataEngine.createFunction(DerivedDataEngine.java:243) ~[hippo-repository-engine-5.6.3.jar:5.6.3]
at org.hippoecm.repository.deriveddata.DerivedDataEngine.applyFunction(DerivedDataEngine.java:216) ~[hippo-repository-engine-5.6.3.jar:5.6.3]
at org.hippoecm.repository.deriveddata.DerivedDataEngine.applyFunctions(DerivedDataEngine.java:205) ~[hippo-repository-engine-5.6.3.jar:5.6.3]
at org.hippoecm.repository.deriveddata.DerivedDataEngine.compute(DerivedDataEngine.java:186) ~[hippo-repository-engine-5.6.3.jar:5.6.3]
at org.hippoecm.repository.deriveddata.DerivedDataEngine.save(DerivedDataEngine.java:85) ~[hippo-repository-engine-5.6.3.jar:5.6.3]
at org.hippoecm.repository.deriveddata.DerivedDataEngine.save(DerivedDataEngine.java:65) ~[hippo-repository-engine-5.6.3.jar:5.6.3]
at org.hippoecm.repository.impl.SessionDecorator.save(SessionDecorator.java:163) ~[hippo-repository-engine-5.6.3.jar:5.6.3]
at org.onehippo.repository.documentworkflow.task.CopyVariantTask.doExecute(CopyVariantTask.java:103) ~[hippo-repository-workflow-5.6.3.jar:5.6.3]
at org.onehippo.repository.documentworkflow.task.AbstractDocumentTask.execute(AbstractDocumentTask.java:93) ~[hippo-repository-workflow-5.6.3.jar:5.6.3]
… 25 more
Caused by: java.lang.ClassNotFoundException: scot.gov.www.PublicationTypeDerivedData
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1365) ~[tomcat9-catalina-9.0.31.jar:9.0.31]
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1188) ~[tomcat9-catalina-9.0.31.jar:9.0.31]
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_222]
at java.lang.Class.forName(Class.java:264) ~[?:1.8.0_222]
at org.hippoecm.repository.deriveddata.DerivedDataEngine.createFunction(DerivedDataEngine.java:238) ~[hippo-repository-engine-5.6.3.jar:5.6.3]
at org.hippoecm.repository.deriveddata.DerivedDataEngine.applyFunction(DerivedDataEngine.java:216) ~[hippo-repository-engine-5.6.3.jar:5.6.3]
at org.hippoecm.repository.deriveddata.DerivedDataEngine.applyFunctions(DerivedDataEngine.java:205) ~[hippo-repository-engine-5.6.3.jar:5.6.3]
at org.hippoecm.repository.deriveddata.DerivedDataEngine.compute(DerivedDataEngine.java:186) ~[hippo-repository-engine-5.6.3.jar:5.6.3]
at org.hippoecm.repository.deriveddata.DerivedDataEngine.save(DerivedDataEngine.java:85) ~[hippo-repository-engine-5.6.3.jar:5.6.3]
at org.hippoecm.repository.deriveddata.DerivedDataEngine.save(DerivedDataEngine.java:65) ~[hippo-repository-engine-5.6.3.jar:5.6.3]
at org.hippoecm.repository.impl.SessionDecorator.save(SessionDecorator.java:163) ~[hippo-repository-engine-5.6.3.jar:5.6.3]
at org.onehippo.repository.documentworkflow.task.CopyVariantTask.doExecute(CopyVariantTask.java:103) ~[hippo-repository-workflow-5.6.3.jar:5.6.3]
at org.onehippo.repository.documentworkflow.task.AbstractDocumentTask.execute(AbstractDocumentTask.java:93) ~[hippo-repository-workflow-5.6.3.jar:5.6.3]
… 25 more

Caused by: java.lang.ClassNotFoundException: scot.gov.www.PublicationTypeDerivedData

that class should be part of your repository package (repository war which is deployed with your site artifacts)

Hi,

Thanks for your response. Can you clarify this for me though - in the docs it says to define your derived data function in the cms module as we have.

And my understanding was that in the deployment model I linked to in my question, the delivery server does not have the cms war deployed (only repository/platform and site). You say the class should be in the repository war - do you mean the docs are wrong?

Thanks,

David

Derived data isn’t meant to fire on site servers, but scheduled publication shouldn’t be firing there either. What @machak is saying is that adding it to the repository module would solve the not found exception. I don’t think this is a proper fix. The derived data function does belong in the cms module. If you can reproduce this on an archetyp project that would be helpful. Otherwise you can try rasiing an issue in out bug tracker, but I can’t say if and when that will be picked up. Having a reproduction path helps immensely with that process.

are you sure about this…it is not a daemon module or UI related service.

It looks like a bug in the code we use to provision the servers is causing the

-Dhippo.scheduler.disabled=true

mentioned below to be false.