java -jar org.eclipse.osgi_version.jar -console 报错

在看深入理解OSGI:Equinox原理第五章,按照书上说明,在eclipse的plugins目录下执行命令

java -jar org.eclipse.osgi_version.jar -console

本来控制台应该出现

osgi>

但是控制台没有反应,后面发现当前目录下多了一个configuration文件夹,其中有log文件

!SESSION 2018-10-30 22:55:31.170 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_172
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -console

!ENTRY org.eclipse.osgi 4 0 2018-10-30 22:55:31.397
!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.core.runtime.internal.adaptor.ConsoleManager.checkForConsoleBundle(ConsoleManager.java:58)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:331)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:231)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.main(EclipseStarter.java:208)

!ENTRY org.eclipse.osgi 4 0 2018-10-30 22:55:31.404
!MESSAGE Application error
!STACK 1
java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:78)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.main(EclipseStarter.java:208)

发现遇到相同情况
解决方案地址
得知解决方案
是创建configuration/config.ini文件,并添加如下内容

osgi.bundles=file\:org.eclipse.equinox.console_1.0.0.v20111215-1210.jar@start,file:\org.apache.felix.gogo.runtime_0.8.0.v201108120515.jar@start,file:\org.apache.felix.gogo.shell_0.8.0.v201110170705.jar@start

注意:需要内容中的版本,需要根据plugins目录下你自己的jar版本去做替换。

原因是:在equinox的新版本中,内置的OSGI shell被felix gogo shell所替代,所以要运行则需要在上述的配置文件中,添加所需要的4个bundle。

我使用的eclipse版本为:Version: Luna Service Release 2 (4.4.2)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值