Exception when creating rules asynchronously using activity queued from agent
We are using PCS framework. Now in PCS framework when Plan instance is approved, an activity SaveUnionDataRules is queued(asynchronous execution) to create Rule-HC-PCS-UnionData instance for the Plan.
Now our requirement is to auto approve approve the plan through Agent. Now when the activity SaveUnionDataRules gets queued, and wakes up in a different requestor, we are getting exception from Rule-.StandardValidate activity that RulesetContext cannot be obtained(Step 2).
Below is the Stack Trace:
2016-06-09 02:11:58,740 [.PegaWorkManager : 2] [ STANDARD] [ ] [ PCS:01.01.01] ( StandardValidate.Rule_.Action) ERROR - Unable to obtain RuleSet Context
java.lang.NullPointerException: cannot match against null ruleset specification
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:208)
at com.pega.pegarules.data.internal.access.RuleResolver.getHighestRuleSetMatchingSpec(RuleResolver.java:1483)
at com.pega.pegarules.data.internal.access.RuleResolver.addDependentRulesets(RuleResolver.java:1410)
at com.pega.pegarules.data.internal.PRDataProviderImpl.invokeRuleResolutionAddDependentRulesets(PRDataProviderImpl.java:394)
at com.pega.pegarules.exec.internal.basic.DependentRuleSetListPoolImpl.get(DependentRuleSetListPoolImpl.java:141)
at com.pega.pegarules.exec.internal.basic.DependentRuleSetListPoolImpl.get(DependentRuleSetListPoolImpl.java:133)
at com.pega.pegarules.data.internal.access.RuleResolver.getDependentRuleSetList(RuleResolver.java:3453)
at com.pega.pegarules.data.internal.access.RulesetContextImpl.<init>(RulesetContextImpl.java:388)
at com.pega.pegarules.data.internal.clipboard.ClipboardPageBase.getRulesetContext(ClipboardPageBase.java:2021)
at com.pega.pegarules.data.internal.clipboard.ClipboardPageImpl.getRulesetContext(ClipboardPageImpl.java:478)
at com.pega.pegarules.data.internal.access.DatabaseImpl.getRulesetContext(DatabaseImpl.java:6767)
at com.pegarules.generated.activity.ra_action_standardvalidate_0ff04af290f39fa6937493829f0f8ee0.step2_circum0(ra_action_standardvalidate_0ff04af290f39fa6937493829f0f8ee0.java:611)
at com.pegarules.generated.activity.ra_action_standardvalidate_0ff04af290f39fa6937493829f0f8ee0.perform(ra_action_standardvalidate_0ff04af290f39fa6937493829f0f8ee0.java:87)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3275)
at com.pega.pegarules.session.internal.mgmt.Executable.invokeActivity(Executable.java:10265)
at com.pegarules.generated.activity.ra_action_savesetup_daf60e627ed3f61affdeb8098cd5e23f.step10_circum0(ra_action_savesetup_daf60e627ed3f61affdeb8098cd5e23f.java:931)
at com.pegarules.generated.activity.ra_action_savesetup_daf60e627ed3f61affdeb8098cd5e23f.perform(ra_action_savesetup_daf60e627ed3f61affdeb8098cd5e23f.java:222)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3275)
at com.pega.pegarules.session.internal.mgmt.Executable.invokeActivity(Executable.java:10265)
at com.pegarules.generated.activity.ra_action_save_b1fc14fe40dabf9fa7d50d449e66899c.step6_circum0(ra_action_save_b1fc14fe40dabf9fa7d50d449e66899c.java:960)
at com.pegarules.generated.activity.ra_action_save_b1fc14fe40dabf9fa7d50d449e66899c.perform(ra_action_save_b1fc14fe40dabf9fa7d50d449e66899c.java:154)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3275)
at com.pega.pegarules.session.internal.mgmt.Executable.invokeActivity(Executable.java:10265)
at com.pegarules.generated.activity.ra_action_createuniondatarules_b897a6cd613ebace796468b68946c0bd.step18_circum0(ra_action_createuniondatarules_b897a6cd613ebace796468b68946c0bd.java:1430)
at com.pegarules.generated.activity.ra_action_createuniondatarules_b897a6cd613ebace796468b68946c0bd.perform(ra_action_createuniondatarules_b897a6cd613ebace796468b68946c0bd.java:402)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3275)
at com.pega.pegarules.session.internal.mgmt.Executable.invokeActivity(Executable.java:10265)
at com.pegarules.generated.activity.ra_action_saveuniondatarules_8e6dd1832998cc9175aeee0bdc9ae380.step4_circum0(ra_action_saveuniondatarules_8e6dd1832998cc9175aeee0bdc9ae380.java:379)
at com.pegarules.generated.activity.ra_action_saveuniondatarules_8e6dd1832998cc9175aeee0bdc9ae380.perform(ra_action_saveuniondatarules_8e6dd1832998cc9175aeee0bdc9ae380.java:115)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3275)
at com.pega.pegarules.session.internal.mgmt.base.ThreadRunner.runActivitiesAlt(ThreadRunner.java:640)
at com.pega.pegarules.session.internal.mgmt.base.ThreadRunner.runActivities(ThreadRunner.java:567)
at com.pega.pegarules.session.internal.mgmt.PRThreadImpl.runActivities(PRThreadImpl.java:425)
at com.pega.pegarules.session.internal.async.agent.QueueProcessor.executeBatchTask(QueueProcessor.java:259)
at com.pega.pegarules.session.internal.async.agent.QueueProcessor.execute(QueueProcessor.java:322)
at com.pega.pegarules.session.internal.async.BatchRequestorTask.run(BatchRequestorTask.java:884)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.performTargetActionWithLock(PRSessionProviderImpl.java:1192)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:930)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:829)
at com.pega.pegarules.session.internal.async.BatchRequestorTask.run(BatchRequestorTask.java:617)
at com.pega.pegarules.session.internal.async.Agent.runBatchTask(Agent.java:784)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.AsyncServant.processAsyncTask(AsyncServant.java:198)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.AsyncServant.invoke(AsyncServant.java:152)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl._invokeEngine_privact(EngineImpl.java:312)
at com.pega.pegarules.session.internal
Note: When any user manually approves the Plan, the Rule creation using the same steps works good.
Can anyone pls help on how we can mitigate the exception.