I could not reproduce the issue..
could you submit a self-contained, obfuscated test case (DRL +
classes)?
I suspect you are leaving out some detail which is the real cause
of the error
Thanks
Davide
p.s. I used this mock class:
package vrpn;
public class TrackerRemote {
public TrackerUpdate getUpdate() {
return new TrackerUpdate();
}
public class TrackerUpdate {
}
}
and your rule, removing the "message" from the RHS
On 07/30/2013 01:51 AM, De Rooms Brecht wrote:
Op 24/07/2013 14:24, Davide Sottara
schreef:
Two clarifications first:
1) Which version are you using?
I am using version 5.5
2) Is TrackerUpdate a static class
inside TrackerRemote?
In case, could you post the exact "import" statements you are
using?
the TrackerUpdate is not static, but it's a class defined within
the TrackerUpdate class.
public class TrackerRemote
....
public class TrackerUpdate {
public java.util.Date msg_time;
public int sensor;
public double[] pos;
public double[] quat;
public TrackerUpdate() { /* compiled code */ }
}
The full imports and rule is:
package derooms.be.testRule
import derooms.be.server.predefinedtypes.Event;
import derooms.be.test.Message;
import vrpn.TrackerRemote;
rule "TrackerRemote.TrackerUpdate"
when
message:TrackerRemote.TrackerUpdate()
then
System.out.println("Tracker: " + message);
end
Sorry that I didn't sent it earlier, I actually sent this e-mail
already but it didn't came through.
B
Thanks
Davide
On 07/24/2013 02:14 PM, De Rooms Brecht wrote:
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)
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users