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

前端之家收集整理的这篇文章主要介绍了在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! 
原文链接:https://www.f2er.com/bash/389065.html

猜你在找的Bash相关文章