Hi,

You really shouldn't install multiple bundles with same package and same version, otherwise you'll encounter the well-known split-package issue in OSGi container.

Freeman
On 2012-4-5, at 下午4:39, XiLai Dai wrote:

Hello,

Got a problem about Packages Exported by Multiple Bundles. There are 2 bundles exported org.apache.derby.jdbc package.

karaf@trun>install –s mvn:org.apache.servicemix.bundles/ org.apache.servicemix.bundles.derbynet/10.8.1.2_1
karaf@trun>install -s mvn:org.apache.derby/derbyclient/10.8.1.2

karaf@trun> list
[ 222] [Active ] [ ] [ ] [ 60] Apache ServiceMix :: Bundles :: derbynet (10.8.1.2_1) [ 238] [Active ] [ ] [ ] [ 60] Apache Derby 10.8 (10.8.1000002.1095077)

karaf@trun> exports | grep derby.jdbc
   222 org.apache.derby.jdbc; version="10.8.1.2"
   238 org.apache.derby.jdbc; version="0.0.0"

Then, install a bundle with Import-Package like this:
Import-Package: javax.sql,org.apache.derby.jdbc,org.osgi.service.bluepri
nt;version="[1.0.0,2.0.0)",org.osgi.service.cm;version="[1.3,2)"

will throw a ClassNotFoundException:
Caused by: java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDataSource at org .eclipse .osgi .internal.loader.BundleLoader.findClassInternal(BundleLoader.java: 460)[osgi-3.6.2.R36x_v20110210.jar:] at org .eclipse .osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422) [osgi-3.6.2.R36x_v20110210.jar:] at org .eclipse .osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410) [osgi-3.6.2.R36x_v20110210.jar:] at org .eclipse .osgi .internal .baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java: 107)[osgi-3.6.2.R36x_v20110210.jar:] at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[: 1.6.0_24] at org .eclipse .osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:338) [osgi-3.6.2.R36x_v20110210.jar:] at org .eclipse .osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java: 232)[osgi-3.6.2.R36x_v20110210.jar:] at org .eclipse .osgi .framework .internal.core.AbstractBundle.loadClass(AbstractBundle.java:1197) [osgi-3.6.2.R36x_v20110210.jar:] at org .apache .aries .blueprint .container .BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:384) [10:org.apache.aries.blueprint:0.3.1] at org .apache .aries .blueprint .container.BlueprintRepository.loadClass(BlueprintRepository.java: 381)[10:org.apache.aries.blueprint:0.3.1] at org .apache.aries.blueprint.container.GenericType.parse(GenericType.java: 113)[10:org.apache.aries.blueprint:0.3.1] at org .apache .aries.blueprint.di.AbstractRecipe.loadType(AbstractRecipe.java:110) [10:org.apache.aries.blueprint:0.3.1]
         ... 18 more

If uninstall bundle 222, then, the app bundle will be installed successful.

How to process this kind of problem of package exported from multi bundles within karaf?

Thanks.
Xilai

---------------------------------------------
Freeman Fang

FuseSource
Email:[email protected]
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042










Reply via email to