[jboss-jira] [JBoss JIRA] (JBRULES-2683) DroolsSession's initWorkItemManagerFactory method can not work in a OSGi context

Geoffrey De Smet (JIRA) jira-events at lists.jboss.org
Mon Apr 2 09:32:51 EDT 2012


    [ https://issues.jboss.org/browse/JBRULES-2683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12680955#comment-12680955 ] 

Geoffrey De Smet commented on JBRULES-2683:
-------------------------------------------

Currently the code in SessionConfiguration (there is no class named DroolsSession atm) does this:
{code}
            clazz = (Class<WorkItemManagerFactory>) this.classLoader.loadClass( className );
{code}
which goes to CompositeClassLoader
{code}
    public Class< ? > loadClass(final String name,
                                final boolean resolve) throws ClassNotFoundException {
        Class cls = loader.get().load( this,
                                       name,
                                       resolve );
        ...
    }
{code}

CompositeClassLoader is part of knowledge-api and since knowledge-api can successfully load jbpm-flow classes at runtime, I presume this issue has been fixed some time ago.
                
> DroolsSession's initWorkItemManagerFactory method can not work in a OSGi context
> --------------------------------------------------------------------------------
>
>                 Key: JBRULES-2683
>                 URL: https://issues.jboss.org/browse/JBRULES-2683
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-core
>    Affects Versions: 5.2.0.M1
>            Reporter: Antoine Toulme
>            Assignee: Mark Proctor
>             Fix For: 5.4.0.CR1
>
>
> This affects the current trunk.
> The code in the method does this:
> String className = this.chainedProperties.getProperty( "drools.workItemManagerFactory",
>                                                                "org.drools.process.instance.impl.DefaultWorkItemManagerFactory" );
> [..]
> clazz = (Class<WorkItemManagerFactory>) Thread.currentThread().getContextClassLoader().loadClass( className );
> [..]
> clazz = (Class<WorkItemManagerFactory>) SessionConfiguration.class.getClassLoader().loadClass( className );
> None of this can work for the default factory since drools-core does not depend on drools-flow-core (and creating a dependency would create a cycle). Actually, this won't work for customer code as well, since drools-core won't depend on their bundle.
> I suggest to use a declarative service to work around this problem, while keeping this type of instantiation around when OSGi is not on.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list