Support Article
ML7 update fails during UpgradeRuleMessages due to Lexical error
SA-6405
Summary
Pega 7.1.6 to 7.1.7 UPDATE fails with RuntimeException in update logs.
Error Messages
[java] Exception in thread "ip-1-1-1-1" java.lang.RuntimeException: Problem during method invocation (main)
[java] Caused by: com.pega.pegarules.data.internal.access.rdb.TokenMgrError: Lexical error at line 1, column 95. Encountered: "T" (84), after : "\\"
[java] at com.pega.pegarules.data.internal.access.rdb.SQLParserTokenManager.getNextToken(SQLParserTokenManager.java:1210)
.
.
[java] at com.pega.pegarules.data.internal.access.DatabaseImpl.executeRDB(DatabaseImpl.java:6410)
[java] at com.pegarules.generated.activity.ra_action_pzupgraderulemessages_ebb9b00a33b1e148d853d8cd3a43ee07.step2_1_circum0(ra_action_pzupgraderulemessages_ebb9b00a33b1e148d853d8cd3a43ee07.java:553)
.
.
[java] at com.pega.pegarules.deploy.internal.util.UpgradeRuleMessages.main(UpgradeRuleMessages.java:79)
.
.
BUILD FAILED
/smartpaas-backup/vol3/pega7softwares/114717_Pega717-UPD/scripts/setupDatabase.xml:374: The following error occurred while executing this line:
/smartpaas-backup/vol3/pega7softwares/114717_Pega717-UPD/scripts/setupDatabase.xml:2268: Java returned: 1
Total time: 95 minutes 21 seconds
Steps to Reproduce
1. Create a Rule-Message instance in Pega 7.1.6 with '\' in its identifier name. (this will be created but you won't be able to open this Rule again)
2. Run ML7 update process.
Root Cause
pzupgraderulemessages activity was introduced in Pega 7.1.7 to re-calculate the pzInsKey of Rule-Message instances. These instances are migrated to a new table PR4_RULE_MESSAGES and the property, pyClassName was made part of key. So, running this activity is mandatory as part of upgrade/update process starting from Pega 7.1.7.
This activity selects each Rule-Message instance using its pzInsKey and checks if it needs to be recalculated. To fetch the Rule-Message record a plain SQL was used which does not escape any special characters in the pzInsKey (\ etc). User has around 60 Rule-Messages that have '\' in their pzInsKey. As the activity does not escape these characters the activity was throwing an exception and halting the UPDATE process.
Resolution
Instead of using a plain SQL, we should be using a prepared statement which takes care of escaping characters. HFix-20900 has been devised for the same in Pega 7.1.7.
Before running the UPDATE process, edit setupDatabase.xml file, locate the target “Update Finalization“ and remove “Upgrade Rule Messages” from depends. With this change user will be able to update to ML7 without any issues. Post UPDATE process, user needs to apply this HFix-20900 and run the pzUpgradeRuleMessages manually.
Published January 31, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.