felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Ziegeler <cziege...@apache.org>
Subject Question about class loading and SCR (see FELIX-624)
Date Mon, 07 Jul 2008 13:01:43 GMT

I came across a problem related to class loading in SCR and before 
trying to fix this I would get some feedback if this is really a bug 
(see FELX-624).

Now, the problem is as follows - we have three bundles.
Bundle C : Provides a service for SERVICE_X which is registered through SCR.

Bundle A : Provides an abstract class AbstractClass that has a bind and 
unbind method for SERVICE_X. Therefore bundle A imports this service.

Bundle B : Provides a component COMPONENT_Y through SCR which inherits 
from AbstractClass from Bundle A. The class for COMPONENT_Y does nothing 
by itself with SERVICE_X, so there is no import and no import statement 
required for bundle B for SERVICE_X.

All bundles can be deployed and resolved, but when starting bundle B, 
there is a ClassNotFoundException as the SCR implementation searches for 
a bind method with SERVICE_X as the parameter. The SCR implementation 
(DependencyManager#734) uses the classloader from bundle B to load the 
parameter class. In this case this is SERVICE_X which is not visible for 
the classloader of bundle B.

So the question is, should there be a more clever search algorithm to 
resolve the parameter class? Or is this such an obscure use case that 
rather the "workaround" of adding an import statement to SERVICE_X in 
bundle B should be used?

Please note that we ran into this problem several times in the past, but 
never had the time to follow up on it and always used the workaround. We 
work with several abstract classes providing basic service functionality 
comming from a "common" bundle.

Carsten Ziegeler

View raw message