启动 OSGi 包
我尝试在 Eclipse 中运行 OSGi 插件。它是空包,但 Eclipse 总是向我发送错误 有我的控制台消息 http://pastebin.com/dqQfpQhd 怎么了?
I try to run OSGi plug in in Eclipse. It is empty bundle, but eclipse always send me errors
There are my console messages
http://pastebin.com/dqQfpQhd
What is wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
问题是默认目标包含许多与您的包无关的包 - 当所有错误消息完成后输入命令
ss
将列出它们。您要做的如下:
The problem is that the default target includes many bundles that have nothing to do with your bundle -- typing the command
ss
when all the error messages have finished will list them.Here's what you do:
我一整天都在“工作台尚未创建”中挣扎了很多。
但我通过以下步骤得到了解决方案。-
谢谢
I struggled a lot for “Workbench has not been created yet” the complete day.
But I got the solution by the following steps.-
Thanks
这是主要问题:
您正在使用工作台中或与工作台相关的方法/对象,而工作台本身尚未创建。也许您可以延迟捆绑包的激活或从捆绑包的激活/初始化部分中删除“工作台”依赖项。
哎呀,回到开头。日志的最后一行包含“Hello World”——这是您的包的预期输出吗?也许不是您的包导致输出上出现错误和警告。我也看到了一些“mylin”和其他东西。如果可能,请在您的系统中添加另一个全新安装的 eclipse(无需额外的捆绑包/插件),并在该环境中尝试该捆绑包。
来自 关于 eclipsezone 的好文章:
你自己的包的超类是什么?因为这可能会引入对工作台的依赖。
并且 - 如何从 Eclipse 中“启动”捆绑包,或者将其打包并放入 Eclipse 插件文件夹中?这也可能会有所作为。
This is the main problem:
You're using methods/objects from the workbench or related to the workbench while the workbench itself has not been created yet. Maybe you can delay the activation of the bundle or remove 'workbench' dependencies from the activation/initialisation part of the bundle.
Yikes, back to the beginning. The last line of the log containes a 'Hello World' - is this the expected output from your bundle? Maybe it's not your bundle that causes the errors and warnings on the output. I see some 'mylin' and other stuff too. If possible, add another clean installation of eclipse (no additional bundles/plugins) to your system and try the bundle in that environment.
From a good article on eclipsezone:
What's the superclass of your own bundle? Because that could introduce a dependency on the workbench.
And - how do 'start' the bundle, from within eclipse or hav you jar'ed it up and put it in the eclipse plugin folder? That could make a difference too.
这些错误都与您的捆绑包无关。正如您从“Hello World”输出中看到的,您的包启动得很好。
我相信您以错误的方式启动 Eclipse,可能急切地激活所有捆绑包。 Eclipse 需要以“延迟激活”模式启动大多数工作台包。
-console
添加到eclipse.ini
文件中?MANIFEST.MF
config.ini
来自ECLIPSE_HOME/configuration
eclipse.ini
来自ECLIPSE_HOME
None of those errors have anything to do with your bundle. As you can see from the "Hello World" output, your bundle is starting just fine.
I believe you are launching Eclipse in the wrong way, probably eagerly activating all the bundles. Eclipse needs to start with most workbench bundles in "lazy activation" mode.
-console
to theeclipse.ini
file?MANIFEST.MF
from your own bundleconfig.ini
fromECLIPSE_HOME/configuration
eclipse.ini
fromECLIPSE_HOME
首先检查空插件的依赖关系。可能您缺少添加一个插件,该插件在运行时未加载。
如果您的插件有依赖项,请检查使用的插件版本。
您在插件中定义了哪个 Java 版本?它比您在运行时使用的版本更高吗?
你的插件加载DLL了吗?如果是,请检查运行时是否可以找到该DLL。
编辑:
您在 Activator 的 start 方法中定义了什么?
看来您正在使用尚未创建的工作台。
First check the dependencies of the empty plugin. May be you are missing to add a plugin, whcih is not loaded at runtime.
If you have dependencies in your plugin, check hich version of the plugins are used.
Which Java version you have defined in your plugin? Is it higher, than the version you are using at runtime?
Is your plugin loading DLLs? if so, check whether the DLL can be found at runtime.
Edit:
What did you define in the start method of the Activator?
It sems, that you are using the workbench which is not created yet.
在运行你的包之前尝试这样做:
Try to do this before running your bundle: