[rules-users] expectation for -Ddrools.dump.dir to show DRL error context ..

Wolfgang Laun wolfgang.laun at gmail.com
Mon Nov 19 13:36:53 EST 2012


I'm not quite sure that I've been aboard your train of thoughts.

There are compilations where you feed the Drools Builder with non-DRL
files, which will induce it to produce a DRL and compile that,
automatically. This is where the DumpDirOption should produce the
intermediary result in that directory.

If you call some mechanism using XSL and DRT to generate DRL text,
which you then pass to the compiler, you've taken the responsibility
to handle this DRL text. If there is a problem, you might consider
writing the DRL text to a file and call the builder with this file as
a DRL resource.

Note: All of the above assumes I've outguessed your procedure correctly ;-)

Cheers
Wolfgang



On 19/11/2012, Cotton, Ben <Ben.Cotton at morganstanley.com> wrote:
> Oh no.  Ouch!
>
> So the [ERR] messages I'm getting -- w/ explicit line numbers  being
> produced (wrt to some internal DROOLS in-memory DRL representation) --
> cannot in any way be x-referenced with an externalized view of the DROOLS
> in-memory DRL representation?
>
> Thanks for the reply Wolfgang (as always).  But this seems like really bad
> news wrt to a newbie needing to debug their DROOLs DRL (generated from
> template)  code.
>
> If the (generated from template) internal DROOLs DRL representation can't be
> externalized w/ any sort of view via the DROOLs API, Do you have any
> recommendation for a how a developer could "look under the skirt" at this
> part of DROOLs runtime?
>
>
> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org
> [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Wolfgang Laun
> Sent: Monday, November 19, 2012 1:12 PM
> To: Rules Users List
> Subject: Re: [rules-users] expectation for -Ddrools.dump.dir to show DRL
> error context ..
>
> For ResourceType.DRL, the DumpDirOption isn't going to help. It is provided
> for compilations where the source is "pre-DRL", such as decision tables.
>
> -W
>
> On 19/11/2012, Cotton, Ben <Ben.Cotton at morganstanley.com> wrote:
>> Also, FYI, I tried to use the following explicit DROOLs code to see if
>> I could gain a view of the staged .DRL generation.  No luck, my
>> $DroolsDumpDir/ directory has nothing any it.
>>
>> Do I need to do some kind of
>>
>>   File droolsDumpDir = new File( "C:/MSDE/cottoben/DroolsDumpDir/" );
>>         SingleValueKnowledgeBuilderOption ddOption =
>> org.drools.builder.conf.DumpDirOption.get( droolsDumpDir );
>>         KnowledgeBuilderConfiguration kbConfig =
>>             KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
>>         kbConfig.setOption( ddOption );
>>         KnowledgeBuilder kbuilder =
>> KnowledgeBuilderFactory.newKnowledgeBuilder( kbConfig );
>>
>>         kbuilder.add(new ByteArrayResource(drl.getBytes()),
>> ResourceType.DRL);
>>
>>         //compilation errors?
>>         if (kbuilder.hasErrors()) {
>>             System.out.println("Error compiling resources:");
>>             Iterator<KnowledgeBuilderError> errors =
>> kbuilder.getErrors().iterator();
>>             while (errors.hasNext()) {
>>                 System.out.println("\t" + errors.next().getMessage());
>>             }
>>             throw new IllegalStateException("Error compiling resources");
>>         }
>>
>>         //print out the generated .DRL
>>         System.out.println(drl);
>>
>> From: rules-users-bounces at lists.jboss.org
>> [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Cotton, Ben
>> (ISGT)
>> Sent: Monday, November 19, 2012 11:49 AM
>> To: rules-users at lists.jboss.org
>> Subject: [rules-users] expectation for -Ddrools.dump.dir to show DRL
>> error context ..
>>
>> Hi,
>>
>> I thought this worked for me at some point, but, I now seem to have
>> lost my ability to get any debuggable DRL error contexts via the
>> -Ddrools.dump.dir property.
>>
>> Here is my command line, that simply borrows from the DROOLs sample
>> package's  Cheese.xls SpreadsheetCompiler example , to produce a .DRL
>> from an (.XLS, .DRT) input pair:
>>
>> java
>> com.ms.fast.triclear.eligibility.rules.GenerateDRLfromEligibilityRules
>> RepoViaDRT
>> \
>>         -Ddrools.dump.dir=./DroolsDumpDir \
>>
>> ../main/packages/com/ms/fast/triclear/eligibility/rules/IRD_PRODUCT_RU
>> LES_FEED_TO_DRT_Template-BASIS.xls
>> \
>>
>> ../main/packages/com/ms/fast/triclear/eligibility/rules/IRD_PRODUCT_RULES_TEMPLATE-BASIS.drt
>>   \
>>         2>&1 | grep -v Picked | \
>>         tee
>> ../main/packages/com/ms/fast/triclear/eligibility/rules/IRD_PRODUCT_RU
>> LES=RENDERED.drl
>>
>> This command line produces the following errors:
>>
>> Error compiling resources:
>>         [ERR 102] Line 923:0 mismatched input ''
>>         [ERR 101] Line 8:60 no viable alternative at input '"LCH US"'
>> in rule "IRD_PRODUCT_RULE_24"
>>         [ERR 101] Line 46:60 no viable alternative at input '"LCH EU.
>> SCM"'
>> in rule "IRD_PRODUCT_RULE_23"
>>         Parser returned a null Package Exception in thread "main"
>> java.lang.IllegalStateException: Error compiling resources
>>         at
>> com.ms.fast.triclear.eligibility.rules.GenerateDRLfromEligibilityRulesRepoViaDRT.buildKBase(GenerateDRLfromEligibilityRulesRepoViaDRT.java:93)
>>         at
>> com.ms.fast.triclear.eligibility.rules.GenerateDRLfromEligibilityRulesRepoViaDRT.execute(GenerateDRLfromEligibilityRulesRepoViaDRT.java:50)
>>         at
>> com.ms.fast.triclear.eligibility.rules.GenerateDRLfromEligibilityRules
>> RepoViaDRT.main(GenerateDRLfromEligibilityRulesRepoViaDRT.java:44)
>>
>> Unfortunately, my ./DroolsDumpDir/ directory contents are completely
>> empty.
>> I was hopeful it might contain a staged .DRL context from which I
>> could more easily debug my roadblock.
>>
>> Is there more that I have to do, beyond just passing
>> -Ddrools.dump.dir=./DroolsDumpDir on the command line?
>>
>>
>> Ben D Cotton III
>> Morgan Stanley & Co.
>> OTC Derivatives Clearing Technology
>> 1221 AOTA Rockefeller Ctr - Flr 27
>> New York, NY 10020
>> (212)762.9094
>> ben.cotton at ms.com<mailto:ben.cotton at ms.com>
>>
>>
>>
>> ________________________________
>>
>> NOTICE: Morgan Stanley is not acting as a municipal advisor and the
>> opinions or views contained herein are not intended to be, and do not
>> constitute, advice within the meaning of Section 975 of the Dodd-Frank
>> Wall Street Reform and Consumer Protection Act. If you have received
>> this communication in error, please destroy all electronic and paper
>> copies and notify the sender immediately. Mistransmission is not
>> intended to waive confidentiality or privilege. Morgan Stanley
>> reserves the right, to the extent permitted under applicable law, to
>> monitor electronic communications. This message is subject to terms
>> available at the following link:
>> http://www.morganstanley.com/disclaimers If you cannot access these
>> links, please notify us by reply message and we will send the contents
>> to you. By messaging with Morgan Stanley you consent to the foregoing.
>>
>>
>> ________________________________
>>
>> NOTICE: Morgan Stanley is not acting as a municipal advisor and the
>> opinions or views contained herein are not intended to be, and do not
>> constitute, advice within the meaning of Section 975 of the Dodd-Frank
>> Wall Street Reform and Consumer Protection Act. If you have received
>> this communication in error, please destroy all electronic and paper
>> copies and notify the sender immediately. Mistransmission is not
>> intended to waive confidentiality or privilege. Morgan Stanley
>> reserves the right, to the extent permitted under applicable law, to
>> monitor electronic communications. This message is subject to terms
>> available at the following link:
>> http://www.morganstanley.com/disclaimers If you cannot access these
>> links, please notify us by reply message and we will send the contents
>> to you. By messaging with Morgan Stanley you consent to the foregoing.
>>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> --------------------------------------------------------------------------------
>
> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions
> or views contained herein are not intended to be, and do not constitute,
> advice within the meaning of Section 975 of the Dodd-Frank Wall Street
> Reform and Consumer Protection Act. If you have received this communication
> in error, please destroy all electronic and paper copies and notify the
> sender immediately. Mistransmission is not intended to waive confidentiality
> or privilege. Morgan Stanley reserves the right, to the extent permitted
> under applicable law, to monitor electronic communications. This message is
> subject to terms available at the following link:
> http://www.morganstanley.com/disclaimers. If you cannot access these links,
> please notify us by reply message and we will send the contents to you. By
> messaging with Morgan Stanley you consent to the foregoing.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list