Support Article

Compilation Error while saving existing Rule Utility Function



Different versions of the same Rule Utility Function (RUF) has been created leveraging a third party jar imported using a custom codeset.

To comply with changed occurred to the external library a new version of the third party jar has been imported using an updated codeset version.

After this step is not possible anymore to perform a save as of the existing RUF to update the java code of the function.

Error Messages

The following error message is shown on screen:

Error(s) detected while generating java. Compiler reported:
1. ERROR in /com/pegarules/generated/ (at line x) = new;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be resolved to a type

Steps to Reproduce

  1. Create a code-set with some Java libraries. Version 01-01-01.
  2. Create a function (ruleset version 01-01-01) that uses this code-set version.
  3. Save as the function in a different ruleset version (01-01-02)
  4. Import new versions of Java libraries in code-set. Version 01-01-02.
  5. Make code-set version 01-01-02 active.
  6. Create new version of the function (ruleset version 01-01-03).
  7. Observe the error reported on screen.

Root Cause

A software use or operation error: Previous versions of the function doesn't compile anymore with the new codeset version hence the library cannot be generated correctly.

This is blocking because the previous versions of the same RUF still exists and can be invoked legitimately by applications referencing that particular ruleset version to which the function belongs.

In such cases those applications will break when invoking the function.


Perform the following local-changes:
  1. Temporarily re-enable previous codeset version
  2. Disable compilation of pre-existing RUFs.
  3. Activate new codeset version
  4. Save as the existing RUF into a new version

Published April 10, 2017 - Updated May 11, 2017

Have a question? Get answers now.

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