RuleLibrary Reference in another RuleLibrary

Which IIQ version are you inquiring about?

Version 8.3

Share all details related to your problem, including any error messages you may have received.

Hello Team,

We have common RuleLibrary in which we are referring another 2 rule libraries using the tag ‘ReferencedRules’. We are observing a strange issue that methods from one of the referred rule library are not available in the common library whereas other one works fine.

E.g., Common Rule Library: Generic-Lib
Another Ref. Lib 1: Multi-Account-Form-lib (This reference from library works fine )
Ref. Lib 2: Single-Account-Form-Lib (for this we get command not found exception)

Error Logs:2024-05-10 03:42:41,561 ERROR http-nio-8080-exec-3 rest.ui.jaxrs.GeneralExceptionMapper:29 - Uncaught JAX-RS exception.
sailpoint.tools.GeneralException: Command not found: getDivisionDisplayName(java.lang.String) : at Line: 435

Caused by: org.apache.bsf.BSFException: BeanShell script error: bsh.EvalError: Sourced file: inline evaluation of: if( null == selectedIdentity ){ return "<br/><p style=\"color:red;\">N . . . '' : Command not found: getDivisionDisplayName(java.lang.String) : at Line: 435 : in file: inline evaluation of: import sailpoint.object.Identity; import sailpoint.object.Application; impor . . . ‘’ : getDivisionDisplayName ( idenLink .getAttribute ( “divisionId” ) .get ( 0 ) )
BSF info: script at line: 0 column: columnNo
at bsh.util.BeanShellBSFEngine.eval(BeanShellBSFEngine.java:202) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
at org.apache.bsf.BSFManager$5.run(BSFManager.java:445) ~[bsf.jar:?]
… 87 more

Dear @pallavi :

Make sure your source file has references to both rule libraries.
Apart from that, i have provided few more dubugging steps in below-mentioned query,

I will suggest you to kinldy visit the below url :slight_smile:

We tried restarting the server and cleared cache as well but no luck.

Its strange, though if you have given all the reference correctly, Is it possible to move the method to the same Lib 1: Multi-Account-Form-lib (This reference from library works fine ) as check if its working.

I faced similar issue, but after giving reference in all the rule library and server restart it started to work for me.

Meanwhile, i will try to replicate the issue in my test environment.

[Update]

I have tried to replicate, and it works for me if I give the rule reference of the other two rule library ( Multi-Account-Form-lib and Single-Account-Form-Lib ) in the first common library Common Rule Library: Generic-Lib.

Please try to reset caches in a slightly different way - use this code

  import sailpoint.server.Environment;
  import sailpoint.server.Servicer;
  import sailpoint.server.CacheService;

  Environment env = Environment.getEnvironment();
  Servicer services = env.getServicer();
  CacheService caches = (CacheService)services.getService("Cache");
  if (caches != null) {
    caches.forceRefresh(context);
  }

as rule and execute it as run rule task on each IIQ host

2 Likes

@kjakubiak : Dear Kamil , I believe that after the server restart, if all the references are given appropriately, there should not be any cache issue then.

I agree with you, once I was thinking same way as you do now and the code I gave helped :slight_smile: I believe there’s anyway no harm in trying.

@pallavi is your design like below,

`
Common Rule
Ref → Rule 1
Ref → Rule 2

Rule 1 : method A
Rule 2 : method B
`

Now, when you will call method A and B in common Rule. it work for sure. I am thinking you might have some other issue. check your method name may be some syntax error in name or something.

We tried restarting the server post running @kjakubiak’s code. Also we did Debug PageConfiguration ObjectsReset Configuration Cache as suggested by some of the folks. However we are facing the same issue.

Yes correct, we have this kind of design. One thing we are noticing is while calling method A, it works however calling method B, it fails with the given error.

We made sure the code is correct, no syntax error. Also we tried running the rule directly instead of referring and that works fine.

String ruleName = "Rule-CallMethodA";
Rule rule = context.getObjectByName(Rule.class, ruleName);

Map args = new HashMap();
args.put("input", "myvalue");

String value = context.runRule(rule, args);

From what I’ve seen in the past, IdentityIQ does not support nested rule libraries. When IdentityIQ loads a rule, it loads the referenced rules but it does NOT load the transitive references.

So if you have:
Rule A references Rule B
Rule B references Rule C

Then IdentityIQ will load Rule A and Rule B, but not Rule C. Anything that uses Rule C will fail.

If you are at the point where your code is complex enough to require nested rule libraries, I think you’d be a lot better off writing your code in Java. You can take advantage of newer language features, better IDE support, better encapsulation of state, etc.

Hi @kjperkin We do not have transitive references. We have following design:
Main: One Common Rule Library: ‘Generic-Rule-Library’
Reference: Another ‘Multi-Account-Code-Rule-Library’
Reference: Another ‘Single-Account-Code-Rule-Library’

SO here in this case, we are able to call methods from ‘Multi-Account-Code-Rule-Library’ in the Generic-Rule-Library. However not able to call method from ‘Single-Account-Code-Rule-Library’ in the Generic-Rule-Library.

@pallavi
Which environment is this happening, if this is in lower did you try moving the second one to a complete different rule with a new name and refer that and see if this is happening, just to make sure this is definitely a cache issue

Also is this consistent across environments or just specific to one environment.

Hi @iamksatish This issue is reproducible in other envs. as well. We tried adding the other rule (simple rule with method with just one log statement) but got the same issue to invoke the method - command not found.

@pallavi
Then its not a cache issue as this is across environments and happening with another rule as well
Did you try switching the sequence of reference rules and test once , if this is happening with the rule reference 1?

Also which patch version are you on 8.3?

Also is it possible to share all the three rules here.

Thank you all for your support. We are able to fix this issue, It was needed to add the reference in the Form object.

2 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.