Oracle® Business Rules User's Guide 10g (10.1.3.1.0) Part Number B28965-02 |
|
|
View PDF |
This appendix contains workarounds and solutions for issues you may encounter when using Oracle Business Rules. The following topics are covered:
Choice List with Client and Server Using Different Locale Generates Invalid RL Language
Invalid RL Language Generated When Inherited Classes are Used
Public fact variables are not accessible with Rule Author. For example, the variables in the following class would be accessible with Oracle Business Rules RL Language but not with Rule Author:
public class Test { public int i = 0; public String s = "string"; }
No variable can be accessed in the Rule Author for facts of type Test. In order to access these variables, methods like the following need to be added:
public void setI(int i) { this.i = i; } public int getI() { return i; } public setB(boolean b) { this.b = b; } public boolean isB() { return b; }
Note that no variable i
is required for setI(int i)
and getI()
to work properly. For more information, please refer to the Sun Microsystems Java Bean specification.
For RL generated from the SDK (for example, Rule Author), global variables may not be referred to directly in an RL function.
To work around this issue, if an RL function needs to access a global variable, the global variable should be passed as a parameter to the RL function. The parameter name allows access to the global variables inside the RL function body.
If you choose to run Rule Author using JDK 1.4.2, be aware that Java classes compiled using JDK 1.5 do not import properly. If you try to import Java classes compiled using JDK 1.5 into Rule Author using JDK 1.4.2, an error message like the following appears:
Cannot perform operation. 'RUL-01527: Received exception for loadClass. RUL-01016: Cannot load Java class example7.Example7. Please make sure the class and all its dependent classes are either in the class path, or user specified path. Root Cause: example7/Example7 (Unsupported major.minor version 49.0) '
To work around this issue, run Rule Author using JDK 1.5 or recompile the classes using JDK 1.4.2.
If you are running Rule Author on Firefox browser, you may encounter a problem if you close many popup windows using the X button in the upper corner of the window instead of the OK, Cancel, or Apply buttons.
The easiest way to avoid this problem is to use the OK, Cancel, or Apply buttons instead of the window controls to close the popup windows. You can also change value of the dom.popup_maximum
parameter to allow for many more popup windows. To do this:
Type about:config
as the URL and locate the dom.popup_maximum
parameter.
Set the value to 10000 or higher.
The built-in data type String
does not contain any methods. Thus, if x
is a String, x.substring(1)
would be invalid in an advanced expression.
To work around this issue:
Import java.lang.String
into the data model as a Java fact type.
Give this fact type an alias. The default alias is java_lang_String
.
Use this new fact type instead of String
when you are defining RL fact types or variables in the data model.
Classes and interfaces used in Rule Author must follow the following rules:
If you are using a class or interface and its superclass, the superclass must be declared first. Otherwise, the generated RL program throws an exception like the following:
"FactClassException: fact class for 'pkg.Parent' should be declared earlier in rule session".
If you are using a class or interface, only its superclass or one of its implemented interfaces may be mentioned. If multiple interfaces are mentioned, the generated RL Language program throws an exception like the following:
MultipleInheritanceException: fact class 'pkg.Child' cannot extend both 'pkg.ParentInterface' and 'pkg.ParentClass'
To work around these issues:
Identify the hierarchy of classes and interfaces in the data model you want to use in your rule sets.
For each class or interface in the hierarchy, check the Support Xpath Assertion box. This causes fact class statements to be generated in the correct order as part of the data model RL.
In order to validate generated RL from Rule Author, make sure that the Java classes in the Data Model are in the OC4J classpath. Likewise, when using XML schema, the generated JAXB classes need to be in the classpath. For more information about setting the OC4J classpath, see Section 3.11, "Working with Test Rulesets".
Invalid RL Language is generated if an RL Language reserved word (for example, the word rule
in mypkg.rule.com
) is part of the Java package name. If an RL Language reserved word is used in a Java package name, an error message like the following appears:
Oracle RL 1.0: syntax error PareseException: encountered 'rule' when expecting one of: <XML_IDENTIFIER> ...<IDENTIFIER> ... "*" at line 11 column 19 in main
There is no workaround for this issue; do not use RL Language reserved words in Java package names.
Rule Author does not list the methods supporting a Java bean property in choice lists; only the bean properties are visible. For example, a Java bean with a property named "Y" must have at least a getter method (getY()
) and may also have a setter method (setY(y-type-parm)
). All of properties and methods (including getter and setter that compose the properties) are displayed when viewing the Java FactType. Only the properties of Java Classes (not the getter and setter methods) are displayed in choice lists. When attempting to control the visibility of the property it is best to use the properties visibility flag. Marking a getter or a setter method as not visible may not remove the properties from choice lists.
There is no current workaround for this issue.
The XML Fact page for an XML Schema generated class shows the Support XPath Assertion box. This box is checked by default. Un-checking this box and saving your changes marks the XML Fact as not supporting XML style assertion, which in turn means that any instance of this type and any of its children are not asserted by a call to assertXPath for an XML document.
There is no workaround for this issue; you should make sure the Support XPath Assertion box is checked for all XML FactTypes.
To change the Rule Author display language, you need to log out, change the language, and then log back in to Rule Author.
If you do not log out, you may see a java.lang.NullPointerException
error.
The procedure required to change the language is:
Log out of Rule Author.
Change the language in the browser.
Log back in to Rule Author
On Microsoft Windows operating systems, a file in use by one application may not be used by another application. This means it is possible for an error to occur when Rule Author attempts to write to a local file repository while an application is attempting to read from the same repository. This should be a rare occurrence because of the small time windows involved.
The signature for this type of failure looks similar to the following:
oracle.rules.sdk.store.StoreException: Unable to rename '<your-repository-file-name>' so that it can be replaced. at oracle.rules.sdk.store.jar.JarStore.writeJar(JarStore.java:752) at oracle.rules.sdk.store.jar.JarStore.flush(JarStore.java:211) at oracle.rules.sdk.repository.impl.RuleRepositoryImpl._flushChanges(RuleRepositoryImpl.java:381) at oracle.rules.sdk.repository.impl.RuleRepositoryImpl._save(RuleRepositoryImpl.java:367) at oracle.rules.sdk.repository.impl.RuleRepositoryImpl.save(RuleRepositoryImpl.java:265) at oracle.tip.tools.ide.rules.ide.jdeveloper.JDevRulesProject.saveDictionary(JDevRulesProject.java:83)
This can be caused by another rules based application reading the repository at the same time as this attempt to update it. The operation may be retried. If this error persists, then some other application is keeping the repository open.
To workaround this issue, simply retry the operation.
The properties of a superclass are visible in the appropriate choice lists, but the methods of the ancestor classes are not visible.
There is no workaround for this issue.
Sometimes when you attempt to add a schema Rule Author reports the following error:
Cannot perform operation. 'RUL-01627 The schema X has been imported. Please delete it if you want to reimport the same schema
When you add the schema is not displayed in the schema path box, so it appears that either the list is incorrect or the error is incorrect. The workaround for this problem is to reload the XMLFact page, then add the schema again.
The choice list entry that denotes "nothing selected" is translated. The translated value is controlled by the locale set in the RuleDictionary. There are two usage cases in which this can trigger incorrect behavior in the Rules SDK.
The RuleDicitonary
has a setLocale
method. In a client/server usage if the client and server are not using the same locale and the server locale is not English, then failure to use setLocale to set the locale in the client can result in the generation of invalid RL Language.
If the server locale is not English and the application never invokes a setX
(where X is the property name for the list, then the Rules SDK does not correctly set the unselected entry back to the canonical form (which is English). This results in generated that does not compile correctly (usually due to missing values)
To work around these issues:
When an application may be running in an environment where the client and server may be using different locales or the server may not be an English locale, the application should use the RuleDictionary
setLocale
to set the locale to that of the client, if lists are being displayed, and all lists should be set. For example, this problem might occur when a Expression Form property is not set explicitly by the application.
In some cases invalid RL Language is generated for a rule set. The following error is reported when you attempt to execute this code:
A syntax error is found. Error:fact class should be declared earlier at line X column Y in rulesetZ
This error occurs when two Java classes that have an inheritance relationship are used in a ruleset and the child class is used before the parent class. This use can be in a rule condition, an assert
, a retract
, or an assertXPath
. If a subclass or interface is referenced in one of these contexts before the super class is, then a reference to the super class in one of these contexts results in a FactClassException
when the RL Language is interpreted.
Rule Author does not generate the correct RL Language, a fact class
statement, to resolve this issue when the supports xpath
attribute for each Java class involved is set to false
in the datamodel (this is the default).
To workaround this issue, the supports xpath
attribute for each Java class involved should be set to true
in the datamodel. In Rule Author, this is accomplished using a checkbox when viewing the Java class. For some classes, this workaround may not generate correct RL Language because the fact class
statements are not generated in the correct order. In this case, there is no workaround.
Some inheritance hierarchies are not allowed in RL Language, specifically ones that require multiple inheritance. For instance, if Interface2
extends Interface1
, and Class1
directly implements both interfaces, then a single inheritance tree cannot be determined. If Class1
only implemented Interface2
, then a single inheritance tree can be determined and the classes used in RL Language.
See Also:
"Viewing Java Objects in a Data Model"