Hi, I am trying to load a JAR which contains only a change set XML and its DRL files, but Drools (both 5.1.1 and 5.4.0) always complains that the DRL files cannot be found because they don't exist. For example:
<?xml version="1.0" encoding="UTF-8"?> <change-set xmlns='http://drools.org/drools-5.0/change-set' xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' xs:schemaLocation='http://drools.org/drools-5.0/change-set http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd'> <add> <resource source='classpath:com/my/stuff/rules/Stuff.drl' type='DRL' /> </add> </change-set> So Drools is obviously loading my change set XML correctly, at the very least. The Drools documentation <http://docs.jboss.org/drools/release/5.4.0.Final/drools-expert-docs/html/ch03.html#d0e2434> implies that what I am doing is correct, but it looks like the Change Set XML parser is forgetting to use my custom class loader when reading the <resource> elements: The following patch fixes my problem: --- org/drools/xml/changeset/ResourceHandler.java.orig 2012-09-20 17:08:18.209547000 +0100 +++ org/drools/xml/changeset/ResourceHandler.java 2012-09-20 17:10:22.019335902 +0100 @@ -77,7 +77,7 @@ InternalResource resource = null; if ( src.trim().startsWith( "classpath:" ) ) { - resource = new ClassPathResource( src.substring( src.indexOf( ':' ) + 1 ) ); + resource = new ClassPathResource( src.substring( src.indexOf( ':' ) + 1 ), parser.getClassLoader() ); } else { resource = new UrlResource( src ); ((UrlResource)resource).setBasicAuthentication(basicAuthentication); Is this patch correct please, or have I completely misunderstood the Drools documentation? Thanks, Chris -- View this message in context: http://drools.46999.n3.nabble.com/Cannot-find-nested-resources-when-dynamically-loading-rules-JAR-tp4019889.html Sent from the Drools: User forum mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
