Filtering the facts in the GetObjectsCommand doesn't do any object filtering!.
Here are the two code pieces that were used to set the ObjectFilter into GetObjectsCommand, but didn't produce the expected filtered results.
Trial 1:
ObjectFilter filter = new ObjectFilter() { @Override public boolean accept(Object object) { return object.getClass().getName().equals("a.b.c.PotentialFraudFact"); } }; Command<?> getObjects = commandsFactory.newGetObjects(filter, "out");
Trial 2:
ClassObjectSerializationFilter filter = new ClassObjectSerializationFilter(PotentialFraudFact.class); Command<?> getObjects = commandsFactory.newGetObjects(filter, "out");
In the response, the "out" identifier has all facts, not just the ones matching the given filter. It's as if it ignores the filter. Also, no error messages appear in the console.
When a ClassObjectFilter is used instead of the aforementioned implementations, a ClassNotFoundException (shown below) for the a.b.c.PotentialFraudFact.class occurs. This is incorrect as the deployed container/KJAR has this class!.
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.ClassNotFoundException: a.b.c.PotentialFraudFact from [Module "deployment.kie-server.war" from Service Module Loader] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198) at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400) at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at org.drools.core.ClassObjectSerializationFilter.accept(ClassObjectSerializationFilter.java:50) ... 73 more
The issue is with this line https://github.com/kiegroup/drools/blob/4c6856223b8be47b4fc52c35423be8b50e46b501/drools-core/src/main/java/org/drools/core/ClassObjectSerializationFilter.java#L50 where the class loader used to find the class couldn't find the class that corresponds to the given Fact.
- clones
-
DROOLS-3460 KIE Server REST Command GetObjects with ObjectFilter not working
- Closed
- is duplicated by
-
RHDM-814 KIE Server REST Command GetObjects with ObjectFilter not working
- Closed