环境描述:
组件三个,Summer3.0.0,Summer4.0.0,Autum3.0.0
依赖关系: Autum3.0.0依赖Summer3.0.0
MANIFEST文件分别如下:
Summer4.0.0:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Summer Plug-in
Bundle-SymbolicName: Summer
Bundle-Version: 4.0.0
Bundle-Activator: summer.Activator
Bundle-Localization: plugin
Import-Package: org.osgi.framework;version="1.3.0"
Export-Package: summer.core;version="4.0.0"
Summer3.0.0:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Summer Plug-in
Bundle-SymbolicName: Summer
Bundle-Version: 3.0.0
Bundle-Activator: summer.Activator
Bundle-Localization: plugin
Import-Package: org.osgi.framework;version="1.3.0"
Export-Package: summer.core;version="3.0.0"
Autum3.0.0
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Autum Plug-in
Bundle-SymbolicName: Autum
Bundle-Version: 3.0.0
Bundle-Activator: autum.Activator
Bundle-Localization: plugin
Import-Package: org.osgi.framework;version="1.3.0",
summer.core;version="3.0.0"
Require-Bundle: Summer;bundle-version="3.0.0"
介绍完了环境,下面开始正常的依赖性测试:
1.初始化Equinox Framework
C:\temp>java -jar org.eclipse.osgi_3.2.0.v20060601.jar -console
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
osgi>
2.只安装Autum3.0.0,运行,出错是正常的:
osgi> install reference:file:c:\temp\plugins\Autum_3.0.0.jar
Bundle id is 24
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
24 INSTALLED Autum_3.0.0
osgi> start 24
org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Mi
ssing Constraint: Require-Bundle: Summer; bundle-version="3.0.0"
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(Bundl
eHost.java:294)
3.在之前基础上再安装Summer3.0.0,运行,是可以成功的:
osgi> install reference:file:c:\temp\plugins\Summer_3.0.0.jar
Bundle id is 25
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
24 INSTALLED Autum_3.0.0
25 INSTALLED Summer_3.0.0
osgi> start 24
version 3,addPortfolio
version 3,addPartner
version 3,removePortfolio
osgi>
4.安装Summer4.0.0,停止Autum3.0.0,重启Equinox Framework,启动Autum3.0.0:
C:\temp>java -jar org.eclipse.osgi_3.2.0.v20060601.jar -console
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
24 RESOLVED Autum_3.0.0
25 RESOLVED Summer_3.0.0
26 INSTALLED Summer_4.0.0
osgi> start 24
version 3,addPortfolio
version 3,addPartner
version 3,removePortfolio
osgi>
5.重新初始化Equinox Framework,卸载所有应用,重启,按刚才次序把三个应用全部装上:
C:\temp>java -jar org.eclipse.osgi_3.2.0.v20060601.jar -console
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
osgi> install reference:file:c:\temp\plugins\Autum_3.0.0.jar
Bundle id is 27
osgi> install reference:file:c:/temp/plugins/Summer_3.0.0.jar
Bundle id is 28
osgi> install reference:file:c:/temp/plugins/Summer_4.0.0.jar
Bundle id is 29
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
27 INSTALLED Autum_3.0.0
28 INSTALLED Summer_3.0.0
29 INSTALLED Summer_4.0.0
osgi> start 27
version 4,addPortfolio
version 4,addPartner
version 4,removePortfolio
osgi>
结果是
Autum3.0.0跑去抢Summer4.0.0的东西去了,这是为什么呢,难道是Equinox实现的bug?
分享到:
相关推荐
maven-osgi-plugin-launcher-framework-equinox-1.0.15.jar
基于java的开发源码-OSGi 分布式通讯组件 R-OSGi.zip 基于java的开发源码-OSGi 分布式通讯组件 R-OSGi.zip 基于java的开发源码-OSGi 分布式通讯组件 R-OSGi.zip 基于java的开发源码-OSGi 分布式通讯组件 R-OSGi.zip ...
maven-osgi-plugin-launcher-framework-equinox-1.0.19.jar
maven-osgi-plugin-launcher-framework-equinox-1.0.18.jar
maven-osgi-plugin-launcher-framework-equinox-1.0.17.jar
maven-osgi-plugin-launcher-framework-equinox-1.0.16.jar
maven-osgi-plugin-launcher-framework-equinox-1.0.14.jar
maven-osgi-plugin-launcher-framework-equinox-1.0.13.jar
maven-osgi-plugin-launcher-framework-equinox-1.0.12.jar
maven-osgi-plugin-launcher-framework-equinox-1.0.11.jar
maven-osgi-plugin-launcher-framework-equinox-1.0.10.jar
maven-osgi-plugin-launcher-framework-equinox-1.0.9.jar
maven-osgi-plugin-launcher-framework-equinox-1.0.8.jar
maven-osgi-plugin-launcher-framework-equinox-1.0.8b.jar
赠送jar包:osgi-resource-locator-1.0.1.jar; 赠送原API文档:osgi-resource-locator-1.0.1-javadoc.jar; 赠送源代码:osgi-resource-locator-1.0.1-sources.jar; 赠送Maven依赖信息文件:osgi-resource-locator...
赠送jar包:osgi-resource-locator-1.0.1.jar; 赠送原API文档:osgi-resource-locator-1.0.1-javadoc.jar; 赠送源代码:osgi-resource-locator-1.0.1-sources.jar; 赠送Maven依赖信息文件:osgi-resource-locator...
"spring-osgi-1.2.0-rc1"是Spring OSGi的一个早期版本,"RC1"代表Release Candidate 1,意味着这是正式发布前的最后一个测试版本。在这个版本中,开发者可以期待一些新特性和改进,但同时也可能存在一些未发现的...
例如,OSGi可以被用来在同一个Java虚拟机中管理不同版本的类库,或者用来管理一个应用程序的不同组件。 TOS-ESB(Talend Open Studio for ESB)是Talend公司提供的一款基于开源ESB技术的集成平台,它继承了Talend...
标题中的“OSGI研究笔记1 - Equinox ServletBridge模式下调用Datasource”表明了这篇文章将探讨如何在OSGI(Open Service Gateway Initiative)环境下,利用Equinox的ServletBridge模块来访问和使用DataSource。...
jar包,官方版本,自测可用