[rules-users] [rules-dev] Drools 5 load drl rule file from file system.

Esteban Aliverti esteban.aliverti at gmail.com
Mon Feb 14 06:53:44 EST 2011


Did you try using
ResourceFactory.newFileResource("C:\\savedRules\\rule.drl")? A FileResource
is more appropriated for your case I think.

By the way, this kind of questions should go in rules-users at lists.jboss.org.
I'm forwarding it now.

Best,

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Mon, Feb 14, 2011 at 8:21 AM, stefano82 <illidan.guru at gmail.com> wrote:

>
> hello,
> i devloped a custom rule editor able to create drl file and save them in
> file system under a given directory. (e.g. c:\savedRules\rule.drl).
> The problem is that once the rule is saved i need to run it with drools
> engine.
> In my class i try to load rule in this way:
>
> KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
>
> kbuilder.add(ResourceFactory.newClassPathResource("c:\savedRules\rule.drl"),
> ResourceType.DRL);
>
> but its doesn't work. the exception is "rule.drl cannot be opened because
> it
> does not exist" but it actually exists....
>
> What am I doing wrong? there is another way to load rules directly from
> file
> sistem?
>
> thanks in advice.
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/Drools-5-load-drl-rule-file-from-file-system-tp2491856p2491856.html
> Sent from the Drools - Dev mailing list archive at Nabble.com.
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110214/7ab7ee4b/attachment.html 


More information about the rules-users mailing list