Lasse Wallentin | APC by Schneider Electric | Senior Software
Developer
Phone: ++45 72 190 134 | Mobile: ++45 41 37 7974
Email: lasse.wallentin(a)apc.com | Address: Silcon Allé 1, DK-6000
Kolding
*** Please consider the environment before printing this e-mail
rules-users-bounces(a)lists.jboss.org wrote on 12-08-2009 14:39:12:
Lasse.Wallentin(a)apcc.com wrote:
>>> Can anyone sketch a setup so that I can use Drools from within an
> Eclipse
>>> plugin?
>> I've got it running. You need to make sure your classloaders are the
>> right ones.
>> I use the
>> new PackageBuilderConfiguration(Classloader, Properties)
>>
>> ctor (if you're setting CL later, Properties may fail to apply) and
>>
>> new RuleBaseConfiguration(Classloader)
>>
>> respectively. I guess the knowledge-based apis have matching ctors. I
>> use the classloader of my project, which imports the needed drools
>> namespaces. That last part may need some time, but I's doable.
>>
>
> I have tried the following:
>
> KnowledgeBuilderConfiguration builderConfiguration =
> KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null,
> getClass().getClassLoader());
> KnowledgeBuilder kbuilder =
> KnowledgeBuilderFactory.newKnowledgeBuilder(builderConfiguration);
> Resource pathResource = ResourceFactory.newClassPathResource(path,
> getClass());
> kbuilder.add(pathResource, ResourceType.DTABLE, dtableconfiguration);
>
> However it still fails ...
>
> Does this compare to what you are doing? Are you able to do
DecisionTables
> as well?
Roughly; I use neither knowledge API nor tables. However I guess you're
not importing org.drools.base.extractors, so your classloader won't let
drools load that class. There was a heap of drools stuff I've never
heard of but had to import before it worked.
I have tried importing all packages this does not change anything.
/Lasse