[rules-users] Accessing drools rule file in a jar

Zhang Jing-A52198 j.zhang at motorola.com
Wed Jul 29 15:26:12 EDT 2009


Hi All,

 

I'm trying to load a pkg file by RuleAgent. I use the following in the
class DroolsRuleProcessor in the package com.example:

 

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

 

String packageFILE = "com.example.rule1.pkg";

URL u = DroolsRuleProcessor.class.getResource(packageFILE);

 

Properties props = new Properties();

props.setProperty("file", u.getFile());

 

RuleAgent ag = RuleAgent.newRuleAgent(props);

 

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

 

 

The package file com.example.rule1.pkg is put under the same java
package as DroolsRuleProcessor (i.e., com.example).

 

The above code works fine when executing locally. However, error occurs
when I try to execute it remotely. I pack the class DroolsRuleProcessor
with the pkg file com.example.rule1.pkg into a jar, put the jar into an
ear file and deploy the ear to a server. The RuleAgent cannot find the
pkg file. I guess the reason might be that RuleAgent uses new File(...)
to access and read the file. However, new File(...) cannot get the file
that is contained a jar.

 

So how can I access the pkg file using RuleAgent in this case?

 

Thanks,

Jing

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090729/b84b64dd/attachment.html 


More information about the rules-users mailing list