Showing posts with label OSGI. Show all posts
Showing posts with label OSGI. Show all posts

Wednesday, July 20, 2011

Two bundles with the same package is not allowed

If you are creating a split package (i.e., a package spanning multiple bundles) then exporting/importing this package from both bundles. This sort of thing is specifically not allowed by OSGi, so this is just an error in your bundles.


If you import a package from another bundle, it will completely shadow an internal package of the same name. See the OSGi spec on class search order. Imports are searched before the bundle class path and they are terminal.


Here is a note on internet

  

Friday, January 22, 2010

Equinox …

在使用 Equinox 时,特别要注意的是使用 classloader 去加载资源文件的时候,由于每个 Bundle 拥有独立的 classloader。而有些开源框架会使用顶级 classloader 去加载文件,这个时候会导致在
Equinox 中运行时出错。如在equinox 使用spring 时,若配置文件中采用了classpath:file 这样的方式去加载其他的配置文件,就会出现找不到文件的现象,这个错误就是由这个问题引起的。
另外要注意的就是包的命名问题,如果引用了其他 Bundle Export 的package,那么在当前 Bundle 中就不能再建同样的包了,否则在运行时会出现找不到包中类的现象。