The rules engine is being called from a Web session; the code snippet is
included below.  I neglected to mention that an instance of AClass was being
passed in (see the three commented-out lines in the code snippet).

This seems to be the source of the problem.

With these lines uncommented-out, the output was [one, null, doit] - the
null indicating that the object created by do-startup was not matching in
do-stuff.  With the lines commented-out, the output was [success, doit],
which is the expected result.

I'm sorry to say that I don't understand why passing in an instance of
AClass would make a difference here.

Thanks for your help,
chuck



********** Code snippet ************

HttpServletRequest request;
HttpServletResponse response;

FileReader reader = null;
StatelessRuleSession ruleSession = null;
List results = null;
try {
    Class.forName("org.jcp.jsr94.jess.RuleServiceProviderImpl");
    RuleServiceProvider serviceProvider =
       RuleServiceProviderManager.getRuleServiceProvider(
                      "org.jcp.jsr94.jess");
    //
    // Administration
    //
    RuleAdministrator admin = serviceProvider.getRuleAdministrator();
    HashMap vendorProperties = new HashMap();
    LocalRuleExecutionSetProvider lresp =
        admin.getLocalRuleExecutionSetProvider(vendorProperties);
    reader = new FileReader("..the rules file..");
    RuleExecutionSet ruleSet =
        lresp.createRuleExecutionSet(reader, vendorProperties);
    admin.registerRuleExecutionSet("rules", ruleSet, vendorProperties);

    //
    // Runtime
    //
    RuleRuntime runtime = serviceProvider.getRuleRuntime();
    ruleSession =
        (StatelessRuleSession)runtime.
            createRuleSession("rules", vendorProperties,
                              RuleRuntime.STATELESS_SESSION_TYPE);
    ArrayList inputList = new ArrayList();
    // AClass aC = new AClass();  // removing comments causes the issue
    // aC.setField1("one");
    // inputList.add(aC);
    results = ruleSession.executeRules(inputList);

} catch (Exception e) {
    response.getWriter().write("Error: " + e);
} finally {
    if (reader != null)  reader.close();
    try {
        if (ruleSession != null)  ruleSession.release();
    } catch (Exception e2) {
    }
}

response.getWriter().write("Test results: " + results);


*********************


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Friday, July 23, 2004 4:14 PM
To: [EMAIL PROTECTED]
Subject: Re: JESS: Definstance matching within a module for JSR94

I think Chuck Davis wrote:
>  
> 
> executing within a STATELESS_SESSION_TYPE session causes the do-it rule,
but
> not the do-stuff rule, to fire.  Yet, when run as a JESS batch file, both
> these rules fire.
> 

> All three rules seem to fire and do what they're supposed to.

> How did you determine that some but not all of the rules had fired?

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to