在Equinox OSGi shell中使用install命令安装bundle出现的错误

     在《深入理解OSGi---Equinox原理、应用于最佳实践》一书第109页,按照书上例子启动Equinox 控制台后,紧接着下载随书代码资源,按照如下命令安装bundle:

   


osgi>install  initial@reference:file://d:/Chapter5/bundlehelloworld.jar

#报错信息
gogo: BundleException: Error reading bundle content.


    但是控制台报错了:gogo: BundleException: Error reading bundle content.在我的上一篇博客中,我曾提到eclipse高版本与低版本Equinox shell启动方式有些不同,那么此处估计也是版本问题,eclipse-luna-4.4.2版本正确的安装bundle命令为:

   


osgi>install  file:D:/Chapter5/bundlehelloworld.jar

#安装成功后显示如下信息
Bundle id is 6
Location             file:D:/Chapter5/bundlehelloworld.jar
State                2
Version              1.0.0.201201061743
LastModified         1515576081872
Headers               Bundle-Activator = bundlehelloworld.Activator
 Bundle-ManifestVersion = 2
 Bundle-Name = BundleHelloworld
 Bundle-RequiredExecutionEnvironment = JavaSE-1.6
 Bundle-SymbolicName = BundleHelloworld
 Bundle-Version = 1.0.0.201201061743
 Import-Package = org.osgi.framework;version="1.3.0"
 Manifest-Version = 1.0


ServicesInUse        null
Module               osgi.identity; osgi.identity="BundleHelloworld"; type="osgi
.bundle"; version:Version="1.0.0.201201061743" [id=6]
Bundle                   6|Installed  |    1|BundleHello
3)
BundleContext        null
BundleId             6
SymbolicName         BundleHelloworld
RegisteredServices   null


    输入ss命令,是“short status”的简写。它会列出所有已经安装好的bundle以及这些bundle的状态


osgi> ss

"Framework is launched."


id      State       Bundle
0       ACTIVE      org.eclipse.osgi_3.10.2.v20150203-1939
                    Fragments=1
1       RESOLVED    org.eclipse.osgi.compatibility.state_1.0.1.v20140709-1414
                    Master=0
2       ACTIVE      org.eclipse.equinox.console_1.1.0.v20140131-1639
3       ACTIVE      org.apache.felix.gogo.runtime_0.10.0.v201209301036
4       ACTIVE      org.apache.felix.gogo.shell_0.10.0.v201212101605
5       ACTIVE      org.apache.felix.gogo.command_0.10.0.v201209301215
6       INSTALLED   BundleHelloworld_1.0.0.201201061743 //这是我们刚才安装的bundle


    输入start [id号]即可运行刚才的bundle,id号就是安装完后控制台显示的bundle所在id,此处为6,运行效果


osgi> start 6

hello OSGi!


  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值