Hey Otavio,
You can verify what is exposed by two commands:
packages:imports <bundle-id>
packages:exports <bundle-id>

Also if you library try to use Thread ContextClassLoader you may get these 
errors.

Regards,
Lukasz

> Hello,
> 
> I am having problems making Karaf load the contents of a non-bundled
> java library (Webpshere MQ client 6.0.2.4).
> 
> To have Karaf use them, I have added the following files to the lib directory:
> - com.ibm.mq.jar
> - ibm.mqjms.jar
> - dhbcore.jar
> 
> After that, I modified the startup script so that it loaded those
> files. Additionally, I configured the custom.properties file so that
> they are accessible from outside:
> 
> org.osgi.framework.system.packages.extra=com.google.common.base,\
> com.google.common.collect,sun.misc, com.ibm.mq, com.ibm.mq.jms,\
> com.ibm.msg.client.jms,com.ibm.disthub2.*,com.google.common.collect.*
> 
> Even after doing that, when I deploy my bundle it stays in "resolved"
> state and does nothing. When I bounce Karaf,  I get the following
> exception:
> 
> ERROR: Bundle com.spcs.wsd [78] Error starting
> file:/home/orpiske/environments/wsd-transaction-core-0.0.1-SNAPSHOT/deploy/service_manager-0.0.1-SNAPSHOT-bundle.jar
> (org.osgi.framework.BundleException: Activator start error in bundle
> com.spcs.wsd [78].
> java.lang.NoClassDefFoundError: com/ibm/mq/jms/MQQueueConnectionFactory
>       at 
> com.spcs.wsd.camel.wmq.WmqJmsComponentBuilder.getMQQueueConnectionFactory(WmqJmsComponentBuilder.java:58)
>       at 
> com.spcs.wsd.camel.wmq.WmqJmsComponentBuilder.build(WmqJmsComponentBuilder.java:84)
>       at 
> com.spcs.wsd.service.manager.ServiceManager.registerNewComponent(ServiceManager.java:28)
>       at 
> com.spcs.wsd.service.manager.ServiceManager.<init>(ServiceManager.java:22)
>       at 
> com.spcs.wsd.service.manager.ServiceActivationManager.start(ServiceActivationManager.java:19)
>       at 
> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:629)
>       at org.apache.felix.framework.Felix.activateBundle(Felix.java:1842)
>       at org.apache.felix.framework.Felix.startBundle(Felix.java:1759)
>       at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1163)
>       at 
> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
>       at java.lang.Thread.run(Thread.java:662)
> 
> 
> It looks like Karaf is not exposing or being able to expose the
> contents of that package to other classes. I did a quick test,
> following those steps, but exposing a simple hello-world jar and it
> works flawlessly.
> 
> In addition to those steps, I also tried to run "osgi:install -w
> wrap:file:lib/filename.jar" but it did not work either.
> 
> Would anyone know would prevent Karaf from accessing that library or
> would have any idea of how to overcome this?
> 
> Regards
> -- 
> Otavio R. Piske
> http://orpiske.net

Reply via email to