This is a JDT classpath problem. Either you have the wrong JDT version in your classpath, or you have multiple clashing versions. Either fix it, or switch to use JANINO as your compiler.

   Edson

2010/6/29 Jean-Philippe Steinmetz <jeanphilippe@trilogystudios.com>

Hello everyone,

 

I’m fairly new to Drools, having only worked with a basic setup for a little while now. I’ve successfully gotten a Drools 5.0.1 runtime working with an app running under JBoss 5 but now I need Drools to run under a standalone application. I’ve more or less copied all of the set up that I used in the JBoss app but am experiencing weird compilation problems.

 

My application code looks like the following…

 

KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("MyAgenda");

kagent.applyChangeSet(ResourceFactory.newClassPathResource("my_rules.xml"));

KnowledgeBase kbase = kagent.getKnowledgeBase();

final StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

ksession.addEventListener(new DebugAgendaEventListener());

ksession.addEventListener(new DebugWorkingMemoryEventListener());

KnowledgeRuntimeLogger krlogger = KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession);

 

ksession.insert(myObject);

ksession.fireAllRules();

 

krlogger.close();

ksession.dispose();

 

and my rules file looks like…

 

package mypackage

 

rule "test"

    when

        Object()

    then

        System.out.println("Hello World!");

end

 

Finally this is the output I am seeing from my application…

 

[2010:06:180 18:06:144:info] ResourceChangeNotification created

[2010:06:180 18:06:147:info] ResourceChangeScanner created with default interval=60

[2010:06:180 18:06:147:debug] ResourceChangeNotification monitor added monitor=org.drools.io.impl.ResourceChangeScannerImpl@7d0b8078

[2010:06:180 18:06:149:info] KnowledgAgent created, with configuration:

monitorChangeSetEvents=true scanResources=true scanDirectories=true

[2010:06:180 18:06:149:info] KnowledegAgent has started listening for ChangeSet notifications

(null: 3, 78): SchemaLocation: schemaLocation value = 'http://drools.org/drools-5.0/change-set.xsd' must have even number of URI's.

(null: 3, 78): cvc-elt.1: Cannot find the declaration of element 'change-set'.

[2010:06:180 18:06:181:info] KnowledgAgent applying ChangeSet

[2010:06:180 18:06:182:debug] KnowledgeAgent subscribing to resource=[ClassPathResource path='TestRules.drl']

[2010:06:180 18:06:182:debug] ResourceChangeNotification subscribing listener=org.drools.agent.impl.KnowledgeAgentImpl@61176350 to resource=[ClassPath

Resource path='TestRules.drl']

[2010:06:180 18:06:185:debug] ResourceChangeScanner subcribing notifier=org.drools.io.impl.ResourceChangeNotifierImpl@46794afc to resource=[ClassPathR

esource path='TestRules.drl']

[2010:06:180 18:06:187:debug] KnowledgeAgent ChangeSet requires KnowledgeBuilder

[2010:06:180 18:06:187:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet

[2010:06:180 18:06:315:debug] KnowledgeAgent building resource=[ClassPathResource path='TestRules.drl']

java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;

        at org.drools.commons.jci.compilers.EclipseJavaCompiler$3.acceptResult(EclipseJavaCompiler.java:321)

        at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335)

        at org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:351)

        at org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)

        at org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389)

        at org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56)

        at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)

        at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:690)

        at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:653)

        at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:290)

        at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488)

        at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)

        at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:386)

        at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:120)

        at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:109)

 

Now I’ve checked all of the maven dependencies to make sure the they are all there and I can doubly confirm everything is fine. In fact, I even went so far to make sure the jars included in my app contained the org.eclipse.jdt.core.compiler.CategorizedProblem.class file. The only difference I’ve been able to think of so far is that my standalone application uses the Java service wrapper where JBoss does not.

 

Any help is greatly appreciated.

 

Cheers,

 

Jean-Philippe Steinmetz


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com