Java 导出具有依赖项的捆绑包与其他捆绑包

Java 导出具有依赖项的捆绑包与其他捆绑包,java,osgi,equinox,Java,Osgi,Equinox,我有这个OSGI配置: /configurations config.ini somebundle.properties /plugins bundleA bundleB osgi-3.4.2-R34x_v2008826-1230.jar org.eclipse.equinox.common_3.4.0.v20080421-2006.jar org.eclipse.update.configurator_3.2.201.R34x_v20080819.jar com.tes

我有这个OSGI配置:

/configurations
   config.ini
   somebundle.properties
/plugins
   bundleA
   bundleB
osgi-3.4.2-R34x_v2008826-1230.jar
org.eclipse.equinox.common_3.4.0.v20080421-2006.jar
org.eclipse.update.configurator_3.2.201.R34x_v20080819.jar
com.test.arquitectura.osgi.ConfiguratorModule_1.0.0.jar
我的config.ini如下所示:

osgi.bundles=org.eclipse.equinox.common@2:start, \
    org.eclipse.update.configurator@3:start, \
    com.test.arquitectura.osgi.ConfiguratorModule_1.0.0.jar@3:start
osgi.clean = true
eclipse.ignoreApp=true
osgi.parentClassLoader=app
那么,好吧,当我执行

java -Xms256M -Xmx1280M -jar osgi-3.4.2-R34x_v20080826-1230.jar 
它读取config.ini,因此使用equinox.common和update.configurator捆绑包,它会检测部署在/plugins文件夹中的所有捆绑包。之后,ConfiguratorModule a custom bundle只读取上下文中的所有bundle,并执行每个bundle a和bundle B的start方法。我有一个eclipse项目bundleC,它使用bundleA和bundleB中定义的一些类别,因此MANIFEST.MF是:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: BundleC Plug-in
Bundle-SymbolicName: com.test.bundlec
Bundle-Version: 1.0.0
Bundle-Activator: com.test.bundlec.Activator
Import-Package: javax.naming,javax.sql,org.osgi.framework;version="1.3
 .0",org.osgi.util.tracker;version="1.3.1"
Bundle-ClassPath: .
Require-Bundle: com.test.BundleA;bundle-version="1.0.0",
com.test.BundleB;bundle-version="1.0.0"
因此,我想为bundleC项目生成一个插件jar文件。由于requirebundle选项中有两个bundle,那些项目BundleA和BundleB应该在bundleC类路径中,不是吗?因此,在这种情况下,我只是通过将其导出为插件开发来生成捆绑包,并将新捆绑包放在插件文件夹中。有什么我遗漏的吗

好吧,如果我所说的都是对的,这就是我的问题。我有BundleA和BundleB的插件jar文件,但我没有它们的源代码,所以我在将BundleC导出到jar插件时出错,因为很明显,它无法从BundleA和BundleB中找到所需的类。在类路径中没有那些必需的包的情况下,有没有办法生成插件

我尝试对它们进行反编译,然后创建项目,并将它们添加到BundleC的类路径中。我可以生成插件,然后将其放在plugins文件夹中,但在执行osgi环境时,找不到bundleC。我做错了什么


感谢您的回答

为了使用BundleA和BundleB中的内容,他们需要将其导出,例如,他们可以导出一个类供其他bundle使用。然后,在BundleC中,您需要等待BundleA和BundleB被加载,例如BundleListener的实现,尽管这种情况通常是通过服务和ServiceTracker实现的。

请发布您得到的确切错误、任何堆栈跟踪等