[rules-users] uninformative rule parsing/compiling error -> org.drools.rule.Rule cannot be cast to org.drools.rule.Query
De Rooms Brecht
bderooms at vub.ac.be
Wed Jul 24 08:14:15 EDT 2013
Dear rules users,
I am currently writing my own Drools-server since I wanted more control
than the drools-execution server (and it never worked very well here)
where I can send rules/facts over JMS/AQMP/STOMP. Rules which are sent
are saved on the server-side in DRL files that are monitored. That way,
I can debug easily by changing the sent files. However, when I sent the
following code, the agent does not provide me with an error message at
all and hangs:
/
//rule "TrackerRemote.TrackerUpdate"//
// when//
// message:TrackerRemote.TrackerUpdate()//
// then//
// System.out.println("Tracker: " + message);//
//end/
at first I thought it was because TrackerRemote.TrackerUpdate is not in
that package anymore and thus unknown so I tried to send the rule listed
below which gives me the nice and expected error:
Unable to resolve ObjectType 'NotExistingType' : [Rule name='Foo']
/rule "Foo"//
// when //
// NotExistingType( bloe == "test")//
// then//
// System.out.println("this should not work");//
//end/
when I compile the rule myself with a KnowledgeBuilder:
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
InputStream is = new ByteArrayInputStream(drlstring.getBytes());
kbuilder.add( ResourceFactory.newInputStreamResource(is),ResourceType.DRL );
I receive the error:
org.drools.rule.Rule cannot be cast to org.drools.rule.Query
which I think doesn't tell me anything about the mistake I made in my
rule, is this a Drools bug and should I post this somewhere?
Kind Regards,
De Rooms Brecht
Full Stack:
java.lang.ClassCastException: org.drools.rule.Rule cannot be cast to
org.drools.rule.Query
at
org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:175)
at
org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:118)
at
org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:67)
at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:84)
at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2706)
at
org.drools.compiler.PackageBuilder.compileRules(PackageBuilder.java:930)
at
org.drools.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:839)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:831)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:467)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:673)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:45)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:34)
at
derooms.be.server.listeners.RulesListener.processMessage(RulesListener.java:33)
at
derooms.be.server.listeners.AbstractListener.onMessage(AbstractListener.java:35)
at
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1321)
at
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:131)
at
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:202)
at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:129)
at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:47)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130724/334fa914/attachment-0001.html
More information about the rules-users
mailing list