在Eclipse中运行OSGI工程出错的解决方案
今天学习OSGI的过程中按照书上所述搭建好第一个helloworld插件工程,运行的过程中出现下面所示的错误:
!SESSION 2014-06-09 21:04:49.038 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_35
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments: -dev file:E:/XJTU/.metadata/.plugins/org.eclipse.pde.core/Hello OSGI/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog -console
!ENTRY org.eclipse.osgi 4 0 2014-06-09 21:04:49.616
!MESSAGE Could not find bundle: org.eclipse.equinox.console
!STACK 0
org.osgi.framework.BundleException: Could not find bundle: org.eclipse.equinox.console
at org.eclipse.osgi.framework.internal.core.ConsoleManager.checkForConsoleBundle(ConsoleManager.java:211)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:298)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
于是乎上网google发现需要同时引入org.eclipse.equinox.console这个bundle,赶紧照做,如下图所示;
原以为就此可以大功告成,不料...,看下文(等待我的是更多的Exception)
!SESSION 2014-06-09 21:09:17.097 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_35
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments: -dev file:E:/XJTU/.metadata/.plugins/org.eclipse.pde.core/Hello OSGI/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog -console
!ENTRY org.eclipse.equinox.console 4 0 2014-06-09 21:09:17.725
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: The bundle "org.eclipse.equinox.console_1.0.100.v20130429-0953 [6]" could not be resolved. Reason: Missing Constraint: Import-Package: org.apache.felix.service.command; version="0.8.0"
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1332)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1316)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1176)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
!ENTRY org.eclipse.osgi 4 0 2014-06-09 21:09:17.725
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.equinox.console_1.0.100.v20130429-0953.jar was not resolved.
!ENTRY org.eclipse.osgi 4 0 2014-06-09 21:09:17.725
!MESSAGE Could not start bundle: org.eclipse.equinox.console
!STACK 0
org.osgi.framework.BundleException: Could not start bundle: org.eclipse.equinox.console
at org.eclipse.osgi.framework.internal.core.ConsoleManager.checkForConsoleBundle(ConsoleManager.java:217)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:298)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: org.osgi.framework.BundleException: The bundle "org.eclipse.equinox.console_1.0.100.v20130429-0953 [6]" could not be resolved. Reason: Missing Constraint: Import-Package: org.apache.felix.service.command; version="0.8.0"
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1332)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1316)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300)
at org.eclipse.osgi.framework.internal.core.ConsoleManager.checkForConsoleBundle(ConsoleManager.java:215)
... 10 more
Root exception:
org.osgi.framework.BundleException: The bundle "org.eclipse.equinox.console_1.0.100.v20130429-0953 [6]" could not be resolved. Reason: Missing Constraint: Import-Package: org.apache.felix.service.command; version="0.8.0"
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1332)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1316)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300)
at org.eclipse.osgi.framework.internal.core.ConsoleManager.checkForConsoleBundle(ConsoleManager.java:215)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:298)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
!ENTRY org.eclipse.osgi 2 0 2014-06-09 21:09:17.735
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2014-06-09 21:09:17.735
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.equinox.console_1.0.100.v20130429-0953.jar was not resolved.
!SUBENTRY 2 org.eclipse.equinox.console 2 0 2014-06-09 21:09:17.735
!MESSAGE Missing imported package org.apache.felix.service.command_0.8.0.
!ENTRY org.eclipse.osgi 2 0 2014-06-09 21:09:17.745
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2014-06-09 21:09:17.745
!MESSAGE Bundle org.eclipse.equinox.console_1.0.100.v20130429-0953 [6] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.console 2 0 2014-06-09 21:09:17.745
!MESSAGE Missing imported package org.apache.felix.service.command_0.8.0.
!SUBENTRY 2 org.eclipse.equinox.console 2 0 2014-06-09 21:09:17.745
!MESSAGE Missing optionally imported package org.osgi.service.cm_0.0.0.
实在是郁闷的慌,于是乎又开始各种search
终于找到了终极解决方案,即再次加入三个org.eclipse.equinox.console必须的依赖bundle,分别是:
- <span style="font-family:Microsoft YaHei;font-size:14px;"> org.apache.felix.gogo.command org.apache.felix.gogo.runtime org.apache.felix.gogo.shell</span>
概括一下:当Run时报错,只选种org.eclipse.equinox.console时还是会报错,那时因为OSGI组建之间存在依赖关系,要使用 org.eclipse.equinox.console必须要有它需要依赖的OSGI组建,因此在调试时,除了选择自己编写的OSGI组建还要选择上面的三个bundle。貌似这个问题在之前的Eclipse版本中没有滴,估计是进一步的重构之后的缘故。总之,按照这种方式就可以顺利的Run了。
在osgi>提示符输入ss命令,可以看到如下的详情:
在Eclipse中运行OSGI工程出错的解决方案的更多相关文章
- eclipse中运行出错:无法初始化主类的解决办法
问题描述:eclipse中运行程序时,出现如下错误 解决办法: 出现此类:无法初始化主类有可能是因为eclipse中Java的版本与JDK的版本不匹配,我开始用的时候eclipse中用的是Java s ...
- 在eclipse中运行storm-starter
开源软件官网提供的demo无疑是学习开源软件的最好的最原始的样例. 在Storm官网里下载apache-storm-0.9.6.zip,里面\examples\storm-starter\src\jv ...
- Eclipse中Maven WEB工程tomcat调试
最近没事了玩一下maven,使用maven管理工程中的依赖包非常的方便.建立maven web工程的时候开始不知道怎么用tomcat来调试,总是使用mave的tomcat插件发布了后来调试,觉得非常的 ...
- Nodejs学习笔记(二)——Eclipse中运行调试Nodejs
前篇<Nodejs学习笔记(一)——初识Nodejs>主要介绍了在搭建node环境过程中遇到的小问题以及搭建Eclipse开发Node环境的前提步骤.本篇主要介绍如何在Eclipse中运行 ...
- monkeyrunner之eclipse中运行monkeyrunner脚本之环境搭建(四)
monkeyrunner脚本使用Python语法编写,但它实际上是通过Jython来解释执行. Jython是Python的Java实现,它将Python代码解释成Java虚拟机上的字节码并执行,这种 ...
- 转载Eclipse中Maven WEB工程tomcat项目添加调试
转载地址: http://blog.csdn.net/free4294/article/details/38260581 一.建立一个maven WEB项目 1.file->new->o ...
- 在Eclipse中运行Web项目Jsp网页时提示端口被占用的解决办法:Several ports (8005, 8888, 8009) required by Tomcat v9.0 Server at localhost are already in use.
问题: 在Eclipse中运行Web项目Jsp网页启动Tomcat时提示端口被占用: Several ports (8005, 8080, 8009) required by Tomcat v9.0 ...
- 在Eclipse中运行JAVA代码远程操作HBase的示例
在Eclipse中运行JAVA代码远程操作HBase的示例 分类: 大数据 2014-03-04 13:47 3762人阅读 评论(2) 收藏 举报 下面是一个在Windows的Eclipse中通过J ...
- 在Eclipse中运行Jboss时出现java.lang.OutOfMemoryError:PermGen space及其解决方法
在Eclipse中运行Jboss时出现java.lang.OutOfMemoryError:PermGen space及其解决方法 在Eclipse中运行Jboss时,时间太长可能有时候会出现java ...
随机推荐
- 攻防世界 Misc 新手练习区 gif Writeup
攻防世界 Misc 新手练习区 gif Writeup 题目介绍 题目考点 仔细联想 字符转换 Writeup 下载附件并打开 104张黑白图 发现是一堆黑色和白色的图片,按某种规律排列,猜想flag ...
- 攻防世界 WEB 高手进阶区 XCTF Web_python_template_injection Writeup
攻防世界 WEB 高手进阶区 XCTF Web_python_template_injection Writeup 题目介绍 题目考点 SSTI模板注入漏洞 Writeup 知识补充 模板注入:模板引 ...
- DDL数据定义语言
DDL数据定义语言 (一)概述 DDL(Data Definition Language):数据定义语言,用来定义数据库对象,库.表.列等:创建.删除.修改 库,表结构.主要分为操作数据库的DDL和操 ...
- mac下将python2.7改为python3
mac下将python2.7改为python3 查看当前电脑python版本 python -V 修改.bash_profile文件 vi ~/.bash_profile //编辑bash_profi ...
- c++学习笔记(七)
位运算和sizeof运算符 位运算 C语言中提供了一些运算符可以直接操作整数的位,称为位运算,因此位运算中的操作数都必须是整型的. 位运算的效率是比较高的,而且位运算运用好的话会达到意想不到的效果. ...
- 问题 K: A/B Problem
题目描述 做了A+B Problem,A/B Problem不是什么问题了吧! 输入 每组测试样例一行,首先一个号码A,中间一个或多个空格,然后一个符号( / 或者 % ),然后又是空格,后面又是一个 ...
- 【Mysql】表锁 行锁 记录锁 间隙锁
Mysql中的锁 基于锁的属性分类:共享锁.排他锁. 基于锁的状态分类:意向共享锁.意向排它锁 根据锁的粒度分类:全局锁.页锁.表级锁.行锁(记录锁.间隙锁.和临键锁),实际上的锁就这些,上面两种分类 ...
- .net工程师学习vue的心路历程(一)
实习一年后,想做一个属于自己的博客网站,准备用core api去搭建服务端接口,前端准备采用vue这样的一个框架.本身时一个服务端程序员,所以来学习记录一些vue的知识点,有什么不足的希望大家指正,谢 ...
- kali 安装typora
一.安装 官网下载文件解压,并移动到 /opt 文件夹下 二.赋权 在typora目录的bin文件夹下执行命令 ./typora 会报错[7442:0707/173355.682906:FATAL:s ...
- X-MagicBox-820的luatOS之路连载系列2
这块MagicBox小巧但外设丰富,盖板上的小液晶屏竟有240*240的分辨率.点亮后若是用最小字体,真有看瞎老王的不瞎之眼之势. 这种屏在某宝也是比较多的,大概就是长这样子: 我们这个820的盖板上 ...