osgi - 如何设置正确的春分安装

标签 osgi equinox

我用谷歌搜索了几个小时,但找不到任何有用的东西。
我开发了一些 OSGi 包,现在我想在 Eclipse IDE 之外的 equinox 容器中运行它们,但它总是抛出异常:

!SESSION 2011-01-03 14:26:58.958 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_CH
Framework arguments:  -Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -console;
Command-line arguments:  -consoleLog -Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -console;

!ENTRY org.eclipse.osgi 4 0 2011-01-03 14:26:59.567
!MESSAGE Error starting bundle: initial@reference:file:javax.transaction_1.1.1.v201006150915.jar/
!STACK 0
org.osgi.framework.BundleException: A fragment bundle cannot be started: javax.transaction_1.1.1.v201006150915 [49]
        at org.eclipse.osgi.framework.internal.core.BundleFragment.startWorker(BundleFragment.java:228)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.startBundle(EclipseStarter.java:1133)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.startBundles(EclipseStarter.java:1126)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.loadBasicBundles(EclipseStarter.java:646)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:301)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:175)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.main(EclipseStarter.java:150)
init dd core...

!ENTRY org.eclipse.osgi 4 0 2011-01-03 14:26:59.773
!MESSAGE Bundle javax.transaction_1.1.1.v201006150915 [49] is not active.

(“init dd core...”文本正确来自我的项目。)

我有以下文件结构:
+configuration
 +config.ini
+ch.thobens.dd.commands_1.0.0.jar
+ch.thobens.dd.common.items_1.0.0.jar
+ch.thobens.dd.core_1.0.0.jar
+ch.thobens.dd.game_1.0.0.jar
+javax.transaction_1.1.1.v201006150915.jar
+org.eclipse.core.contenttype_3.4.100.v20100505-1235.jar
+org.eclipse.core.jobs_3.5.0.v20100515.jar
+org.eclipse.core.runtime.compatibility.auth_3.2.200.v20100517.jar
+org.eclipse.core.runtime.compatibility.registry_3.3.0.v20100520/runtime_registry_compatibility.jar
+org.eclipse.core.runtime_3.6.0.v20100505.jar
+org.eclipse.equinox.app_1.3.0.v20100512.jar
+org.eclipse.equinox.common_3.6.0.v20100503.jar
+org.eclipse.equinox.preferences_3.3.0.v20100503.jar
+org.eclipse.equinox.registry_3.5.0.v20100503.jar
+org.eclipse.osgi.services_3.2.100.v20100503.jar
+org.eclipse.osgi_3.6.0.v20100517.jar

我的 config.ini 文件有以下内容:
osgi.bundles=javax.transaction_1.1.1.v201006150915.jar@start, org.eclipse.core.contenttype_3.4.100.v20100505-1235.jar@start, org.eclipse.core.jobs_3.5.0.v20100515.jar@start, org.eclipse.core.runtime.compatibility.auth_3.2.200.v20100517.jar@start,org.eclipse.core.runtime.compatibility.registry_3.3.0.v20100520/runtime_registry_compatibility.jar@start, org.eclipse.core.runtime_3.6.0.v20100505.jar@start, org.eclipse.equinox.app_1.3.0.v20100512.jar@start, org.eclipse.equinox.common_3.6.0.v20100503.jar@2:start, org.eclipse.equinox.preferences_3.3.0.v20100503.jar@start, org.eclipse.equinox.registry_3.5.0.v20100503.jar@start, org.eclipse.osgi.services_3.2.100.v20100503.jar@start, ch.thobens.dd.commands_1.0.0.jar@start, ch.thobens.dd.common.items_1.0.0.jar@start, ch.thobens.dd.core_1.0.0.jar@start, ch.thobens.dd.game_1.0.0.jar@1:start
eclipse.ignoreApp=true
osgi.noShutdown=true

此处列出的包与我在运行配置中选择“添加所需插件”时选择的包相同。如果我从 Eclipse PDE 运行这些包,它工作正常。

此外,运行命令之间没有区别
java -jar org.eclipse.osgi_3.6.0.v20100517.jar -consoleLog -Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true

当我使用 equinox 启动器时(通过 eclipse.exe)。

谢谢你的帮助

最佳答案

我找到了解决方案(通过eclipse产品导出器):

javax.transaction_1.1.1.v201006150915.jar 本身不是一个 OSGi 包,它是一个 OSGi 框架扩展。

我不得不更改 config.ini 文件:

  • 删除条目
    javax_transaction 包中的
    属性 osgi.bundles
  • 添加了以下行:

    osgi.framework.extensions=javax.transaction_1.1.1.v201006150915.jar
  • 关于osgi - 如何设置正确的春分安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4584995/

    相关文章:

    java - 以编程方式从蓝图中获取 OSGi 服务实例

    java - 设置 OSGi 包的权限

    java - 尝试安装保存在其类路径上的包的 Jar 文件显示 "Cannot Find The File Specified"

    eclipse - 配置 Glassfish 以使用 Equinox

    java - 在 Tomcat 中使用来自 Java Web 应用程序的 OSGi 包

    java - 手动安装 bundle 时,OSGi 声明式服务不会绑定(bind)服务

    JAX-WS 与 Equinox OSGi

    java - 有没有好方法将 Equinox 源添加到 Eclipse 以帮助调试 OSGi 包?

    domain-driven-design - OSGi 应用程序设计和 DDD

    java - 使用 maven-bundle-plugin 安装 OSGi 依赖项