[jboss-jira] [JBoss JIRA] (DROOLS-4810) KIE Server REST Command GetObjects with ObjectFilter not working

Martin Weiler (Jira) issues at jboss.org
Tue Nov 26 12:21:00 EST 2019


Martin Weiler created DROOLS-4810:
-------------------------------------

             Summary: KIE Server REST Command GetObjects with ObjectFilter not working
                 Key: DROOLS-4810
                 URL: https://issues.jboss.org/browse/DROOLS-4810
             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: Martin Weiler
            Assignee: Mario Fusco


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/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. 



--
This message was sent by Atlassian Jira
(v7.13.8#713008)


More information about the jboss-jira mailing list