加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-15 20:06:45 所属栏目:安全 来源:网络整理
导读:在《深入理解OSGi---Equinox原理、应用于最佳实践》一书第109页,按照书上例子启动Equinox 控制台后,紧接着下载随书代码资源,按照如下命令安装bundle: osgiinstall initial@reference:file://d:/Chapter5/bundlehelloworld.jar #报错信息 gogo: BundleExc

在《深入理解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! 

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读