[jboss-jira] [JBoss JIRA] (DROOLS-171) CompositeClassLoader fails on Android

Chris Dolan (JIRA) jira-events at lists.jboss.org
Wed Jun 19 01:01:36 EDT 2013


Chris Dolan created DROOLS-171:
----------------------------------

             Summary: CompositeClassLoader fails on Android
                 Key: DROOLS-171
                 URL: https://issues.jboss.org/browse/DROOLS-171
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions: 5.5.0.Final
            Reporter: Chris Dolan
            Assignee: Mark Proctor
            Priority: Minor


(not sure if this is a bug or a feature request, because I doubt Android is supported)

I'm trying to see how far I can get porting a Drools project to Android. My first roadblock is the following because the Android Dalvik classloader implementation is stricter than Java's implementation:

java.lang.NullPointerException: parentLoader == null && !nullAllowed
 	at java.lang.ClassLoader.<init>(ClassLoader.java:198)
 	at java.lang.ClassLoader.<init>(ClassLoader.java:190)
 	at org.drools.util.CompositeClassLoader.<init>(CompositeClassLoader.java:43)
 	at org.drools.util.ClassLoaderUtil.getClassLoader(ClassLoaderUtil.java:27)
 	at org.drools.RuleBaseConfiguration.setClassLoader(RuleBaseConfiguration.java:945)
 	at org.drools.RuleBaseConfiguration.init(RuleBaseConfiguration.java:421)
 	at org.drools.RuleBaseConfiguration.<init>(RuleBaseConfiguration.java:267)
 	at org.drools.RuleBaseConfiguration.<clinit>(RuleBaseConfiguration.java:175)
 	at org.drools.impl.KnowledgeBaseFactoryServiceImpl.newKnowledgeBaseConfiguration(KnowledgeBaseFactoryServiceImpl.java:37)
 	at org.drools.KnowledgeBaseFactory.newKnowledgeBaseConfiguration(KnowledgeBaseFactory.java:125)


RuleBaseConfiguration is trying to build a default configuration instance, which tries to instantiate a CompositeClassLoader. But that class calls the constructor ClassLoader(null) which is not permitted on Android. Instead, it should call the no-args ClassLoader() constructor. It's not supposed to refer to the parent classloader anyway, so it should be fine to the use the no-args version.

[by the way, the CompositeClassLoader constructor should use DefaultLoader.INSTANCE instead of new DefaultLoader()]


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list