在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! 

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...