LinkedIn
Copied!

Table of Contents

pyEditElement error: The code for the static initializer is exceeding the 65535 bytes limit

This error might occur when a Decision Data rule contains multiple propositions that are spread across various ruleset versions. At the time of the error, the proposition is either blank or is not displayed at all, even if the Decision Data rule references a valid pyEditElement section.

Example message text

When this error occurs, you can see the following message in the application logs:

Caused by: com.pega.pegarules.pub.PRRuntimeException: Failed to compile generated Java com.pegarules.generated.
html_section.ra_stream_pyeditelement_17219faeab387d2d16b2d485081ba8c3: ---------- 

1. ERROR in /com/pegarules/generated/html_section/ra_stream_pyeditelement_17219faeab387d2d16b2d485081ba8c3.java (at line 51)

public class ra_stream_pyeditelement_17219faeab387d2d16b2d485081ba8c3 extends StreamBuilderSection implements StreamBuilder, FUASupport, FUAReusable, WebAllowable { 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The code for the static initializer is exceeding the 65535 bytes limit 

---------- 

1 problem (1 error) 

Compile failed.

Cause

The error is caused by the pyEditElement section that does not compile properly. The root cause of the compilation error is the way Java generation works for such circumstanced rule types as pyEditElement. Java compiles circumstanced pyEditElement sections in the system from the non-circumstanced base version that exists only in the @baseclass. As the number of Decision Data rule instances and the corresponding properties grows across multiple ruleset versions, the java compilation of the pyEditElemnt exceeds the 65 000 byte threshold. 

Solution

To recover from the error, use the @baseclass.pzCleanupEditElement utility. This utility is available in Pega Platform™ versions 8.6, 8.5, 8.4, 8.3.1, and 8.2.4. Use the utility by tuning its parameters and calling it as part of a wrapper activity to clean up pyEditElement sections for a single or multiple Decision Data rules.

Cleaning up redundant pyEditElelement sections from Decision Data rules

In this example use case, you received compilation errors for the Phones and Tablets Decision Data rules, under the Sales business issue. These rules were saved or edited in multiple ruleset versions; DMSample:08-03-01 through DMSample:08-03-12. Perform the following steps to fix the compilation errors:

  1. Set the Param.DecisionDataWithClassNames parameter to "DMOrg-DMSample-SR-Sales-Phones:Phones,DMOrg-DMSample-SR-Sales-Tablets:Tablets"
    where the parameter value is a comma-separated list of fully qualified Decision Data rule names in the format pyClassName:pyPurpose.
  2. Call the pzCleanupEditElement utility and pass the parameter page.
  3. Monitor the utility status. The utility status is set to FAIL in case of a failure.

See the following figure for reference:

Running the pzCleanupEditElement utility as part of a wrapper activity
"Using pzCleanupEditElement utility"
Running the pzCleanupEditElement utility as part of a wrapper activity

 

The utility deletes the pyEditElement sections that are associated with the Phones and Tablets Decision Data rules in DMSample:08-03-01 through DMSample:08-03-11, even if any of the affected ruleset versions is locked. The utility does not delete the pyEditElement section for the rules in the most recent ruleset version (in this case, DMSample:08-03-12).

Excluding rulesets from the cleanup

You can encounter the compilation error with default Decision Data rules that are part of Pega Customer Decision Hub™ or Pega Marketing™, or applications that you built on top of them. In such a case, do not delete the pyEditElement section from the application engine rulesets, for example, PegaMKT-Engine. Instead, edit the pySkipDeleteEditElement When rule to specify the rulesets to skip when cleaning up redundant Decision Data rules.

  1. In Dev Studio, in the Records Explorer, click Decision > When.
  2. Open the pySkipDeleteEditElelement rule.
  3. In the Advanced tab, click Add condition.
  4. Specify the condition to skip a ruleset.
    For example, @startsWith(.pyRuleSet,Pega-MKT-")
  5. Save the rule.

100% found this useful


Related Content

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.