Seems like something else must be going on here. SCR uses Bundle.loadClass() which ultimately just delegates to the class loader of the bundle. The class loader of the bundle should have access to anything which the bundle has access.

Perhaps you are using BND (maven-bundle-plugin) and you are forgetting to include the package with Private-Package, because Export-Package will include it.

-> richard

On 6/10/09 11:47 AM, Aaron Zeckoski wrote:
I get this error when I have not exported the listener package (and
thus the class):
10.06.2009 14:29:28.060 *ERROR* [Thread-6]
org.sakaiproject.kernel.messaging
[org.sakaiproject.kernel.messaging.MessageSentListener] Error during
instantiation of the implementation object
(java.lang.ClassNotFoundException:
org.sakaiproject.kernel.messaging.MessageSentListener)
java.lang.ClassNotFoundException:
org.sakaiproject.kernel.messaging.MessageSentListener
        at 
org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:564)
        at 
org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:58)
        at 
org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1405)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at 
org.apache.felix.framework.searchpolicy.ModuleImpl.getClassByDelegation(ModuleImpl.java:427)
        at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1354)
        at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:750)
        at 
org.apache.felix.scr.impl.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:180)
        at 
org.apache.felix.scr.impl.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:133)
        at 
org.apache.felix.scr.impl.DelayedComponentManager.getService(DelayedComponentManager.java:83)
        at 
org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:274)
        at 
org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:198)
        at 
org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:308)
        at org.apache.felix.framework.Felix.getService(Felix.java:2708)
        at 
org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:357)
        at 
org.apache.felix.eventadmin.impl.handler.BlacklistingHandlerTasks.getEventHandler(BlacklistingHandlerTasks.java:190)
        at 
org.apache.felix.eventadmin.impl.tasks.HandlerTaskImpl.execute(HandlerTaskImpl.java:67)
        at 
org.apache.felix.eventadmin.impl.tasks.DispatchTask.run(DispatchTask.java:159)
        at 
org.apache.felix.eventadmin.impl.dispatch.CacheThreadPool$PooledThread.run(CacheThreadPool.java:265)


I get no failure if I do export my package with my class which
implements the listener.

Are you sure this should not be the case? (I am using the felix DS
stuff here so maybe there is something related to that)

Can anyone suggest what might be causing the failure? Should I attach some code?
-AZ


On Wed, Jun 10, 2009 at 4:28 PM, Richard S. Hall<[email protected]>  wrote:
You shouldn't need to export them, must be something else. The normal case
is that you do not export your service implementations.

->  richard

On 6/10/09 11:15 AM, Aaron Zeckoski wrote:
Should classes which implement EventHandler
(org.osgi.service.eventadmin.EventHandler) have to be exported in
order to work? It seems like when I do not export my class there is a
CNFE but I would have thought it would not be necessary to export
services which are whiteboarded like the EventAdmin is.
Am I missing something here?
-AZ



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]





Reply via email to