Friday, 8 January 2016

IBM ODM Rules - "Scope reference is invalid"

I saw this today: -

whilst trying to deploy my HelloWorld Rules application ( RulesApp ) from Decision Center to Decision Server ( both on 8.5.1.2 ).

I also noticed that my project, as imported from a .ZIP file into Decision Center, was missing the Business Rules ( of which I only have one, Hello World !! ): -


I spoke to one of my colleagues, an ODM Rules Jedi Master, who suggested that the problem might be with locale.

As soon as he said that, I remembered how this goes - 'cos I have seen this before, albeit from the other side.

When one first installs a Decision Center, the default locale is en_US aka English (United States ), and it's common for this NOT to be changed.

However, if one uses Rule Designer on, say, a Windows desktop that's set to default to the English (United Kingdom) then all Rule applications are automatically created with the en_GB locale.

Whilst I know that this can be changed via the Installation Settings Wizard ( either post-installation or via the Configure tab ) : -



it DOES require the Decision Center repository to be EMPTY i.e. containing NO projects.

Given that my client already had several projects deployed, that wasn't an option, leastways in the short term.

Jedi Master Jonathon then explained how I could work around the problem, from the other side - Rule Designer.

Option one - do it properly

Read the IBM Knowledge Centre - Opening Rule Designer in a specific locale - which describes how to add the following parameter : -

osgi.nl=en_US

to: -

C:\IBM\ODM87\configuration\config.ini

Option two - do it hackily

Manually edit the Rule(s)

vi HelloWorld.brl

and change from: -

  <name>HelloWorld</name>
  <uuid>1254da3e-6164-4ff8-8bbe-1cbe49fd715a</uuid>
  <locale>en_GB</locale>
  <definition><![CDATA[definitions
        set 'the message' to "Hello " + 'the request' ;
then
    set 'the response' to 'the message' ;
    print 'the message' ;
    ]]></definition>


to: -

  <name>HelloWorld</name>
  <uuid>1254da3e-6164-4ff8-8bbe-1cbe49fd715a</uuid>
  <locale>en_US</locale>
  <definition><![CDATA[definitions
        set 'the message' to "Hello " + 'the request' ;
then
    set 'the response' to 'the message' ;
    print 'the message' ;
    ]]></definition>


before re-importing the project into Decision Center.

I chose Option 2 in the short-term, but wouldn't, of course, recommend that to anyone else :-)

For the record, the Diagnostics page within Decision Center also highlighted the locale issue: -


In other words, my Ruleflow was using en_GB whereas the Wizard showed me that Decision Center was using en_US.

No comments: