]
Maciej Swiderski reassigned DROOLS-3460:
----------------------------------------
Assignee: Mario Fusco (was: Maciej Swiderski)
KIE Server REST Command GetObjects with ObjectFilter not working
----------------------------------------------------------------
Key: DROOLS-3460
URL:
https://issues.jboss.org/browse/DROOLS-3460
Project: Drools
Issue Type: Bug
Components: kie server
Affects Versions: 7.15.0.Final
Environment: RHEL 7.5, EAP 7.1.0, Drools 7.15.0.Final
Reporter: Balakrishnan Balasubramanian
Assignee: Mario Fusco
Priority: Major
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:+*
{code:java}
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");
{code}
*+Trial 2:+*
{code:java}
ClassObjectSerializationFilter filter = new
ClassObjectSerializationFilter(PotentialFraudFact.class);
Command<?> getObjects = commandsFactory.newGetObjects(filter, "out");
{code}
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!.
{code:java}
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
{code}
The issue is with this line
https://github.com/kiegroup/drools/blob/4c6856223b8be47b4fc52c35423be8b50...
where the class loader used to find the class couldn't find the class that corresponds
to the given Fact.