【问题标题】:Developing plug-ins using eclipse使用eclipse开发插件
【发布时间】:2015-04-18 13:21:22
【问题描述】:

我目前正在尝试开始使用 eclipse 开发/使用 OSGi 包。问题是 eclipse / OSGi 的组合真的很难设置,而且看起来很重。我用一个 Activator 创建了一个简单的“Hello World”包。我尝试将它作为“OSGi 框架”运行,但我收到了错误/异常的垃圾邮件。首先我得到了很多这些错误:

!ENTRY org.eclipse.update.configurator 4 0 2015-04-18 15:03:31.119
!MESSAGE Could not install bundle plugins/org.eclipse.team.core_3.7.0.v20130514-1224.jar   A bundle is already installed with the name "org.eclipse.team.core" and version "3.7.0.v20130514-1224"

我为 Eclipse 附带的每个捆绑包都提供了这个。之后我得到以下异常:

org.osgi.framework.BundleException: Exception in org.eclipse.debug.internal.ui.DebugUIPlugin.start() of bundle org.eclipse.debug.ui.
Caused by: java.lang.IllegalStateException: Workbench has not been created yet.

之后我得到一个与码头相关的异常(为什么?)

org.osgi.framework.BundleException: Exception in org.eclipse.equinox.http.jetty.internal.Activator.start() of bundle org.eclipse.equinox.http.jetty.
Caused by: org.osgi.service.cm.ConfigurationException: default : Permission denied
Caused by: java.net.SocketException: Permission denied

让程序打印“Hello World”似乎很麻烦。有谁知道如何为插件项目设置eclipse?

【问题讨论】:

  • 你在做一个eclipse插件吗??如果是这样您可以将其作为 eclipse 应用程序运行右键单击> 调试为 > eclipse 应用程序而不是 osgi
  • 不,只是一个普通的插件。
  • 看起来你创建了一个 eclipse hello world 插件,所以我认为你应该将它作为 eclipse 应用程序运行,一切都会正确
  • 看起来您使用的东西只能在 Eclipse 插件而不是 OSGi 插件中使用。
  • 好吧,我正在努力学习本教程:vogella.com/tutorials/OSGi/article.html

标签: java eclipse osgi


【解决方案1】:

好吧,事实证明 eclipse 在创建新项目时有点草率。在 Juno 中,您可以创建“插件项目”或“插件开发 > 插件项目”。第一个是 eclipse 插件,后者是一个普通的 OSGi 包。这个名字真的很不幸。

我创建了一个新的 OSGi 捆绑项目,一个新的“OSGi 框架”配置并添加了要点:

org.apache.felix.gogo.command
org.apache.felix.gogo.runtime
org.apache.felix.gogo.shell
org.eclipse.osgi.console

和我自己的捆绑包 (com.vogella.osgi.firstbundle) 到捆绑包。现在一切正常,线程启动并打印到控制台,我可以输入ss / start 等命令。

【讨论】:

    猜你喜欢
    • 2011-01-07
    • 1970-01-01
    • 2020-03-06
    • 1970-01-01
    • 1970-01-01
    • 2013-07-20
    • 1970-01-01
    • 2013-07-10
    • 1970-01-01
    相关资源
    最近更新 更多