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