开发OSGi中遇到的一些问题记录
2018-01-18 17:24
459 查看
问题一:
在《深入理解OSGi---Equinox原理、应用与最佳实践》第325页至329页按照书上指示安装了Spring DM,并且运行了简单的例子,发现运行报错:
Caused by: java.lang.IllegalStateException: The System Bundle was updated. The framework must be restarted to finalize the configuration change
at org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.install(ConfigApplier.java:80)
at org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:191)
atorg.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:205)
at org.eclipse.equinox.internal.simpleconfigurator.Activator.start(Activator.java:60)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
... 25 more
经过排查后是由于jar包重复导致,首先在项目名上右键点击“Run Configuration"打开运行时配置项:
点击”Validate Bundles"按钮,弹出一个对话框,如下:
可以看到有两个org.eclipse.osgi不同版本号的jar包存在,一个是sdk自带的,一个是安装Spring DM后出现的,我们只要把Spring DM路径下的这个jar包移除就行了。参考地址:https://stackoverflow.com/questions/5902291/eclipse-rcp-bundle-activation-error-the-system-bundle-was-updated
问题二:
在第374页进行Eclipse JUnit Plug-in Test测试时,书上指出了那个错误是由于junit的jar包重复导致,让我们不要在”运行时配置项“的“Target Platform”里面选择com.springsource.junit,但是只操作这里还是不行,因为在unittest项目的元数据文件manifest.mf中定义了Require-Bundle: com.springsource.junit,所以如果你如果不勾选这个jar,元数据文件就会一直冒红,并且程序也测试不通过,所以还要这么做一下:将“Require-Bundle: com.springsource.junit”改为
Import-Package: junit.framework
因为导入com.springsource.junit包就是为了使用junit.framework ,而org.junit包里面也有junit.framework ,所以才会重复。
问题三:
在第378页至379页,将Eclipse JUnit Plug-in Test与Spring DM进行集成测试的时候,一直不成功,按照书上的做也不行,debug调试发现根本不走set方法,没有将HelloWorldService注入到实例中 ,不知道还要修改什么启动级别吗?有测试通过的,请告诉我一下。
在《深入理解OSGi---Equinox原理、应用与最佳实践》第325页至329页按照书上指示安装了Spring DM,并且运行了简单的例子,发现运行报错:
Caused by: java.lang.IllegalStateException: The System Bundle was updated. The framework must be restarted to finalize the configuration change
at org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.install(ConfigApplier.java:80)
at org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:191)
atorg.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:205)
at org.eclipse.equinox.internal.simpleconfigurator.Activator.start(Activator.java:60)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
... 25 more
经过排查后是由于jar包重复导致,首先在项目名上右键点击“Run Configuration"打开运行时配置项:
点击”Validate Bundles"按钮,弹出一个对话框,如下:
可以看到有两个org.eclipse.osgi不同版本号的jar包存在,一个是sdk自带的,一个是安装Spring DM后出现的,我们只要把Spring DM路径下的这个jar包移除就行了。参考地址:https://stackoverflow.com/questions/5902291/eclipse-rcp-bundle-activation-error-the-system-bundle-was-updated
问题二:
在第374页进行Eclipse JUnit Plug-in Test测试时,书上指出了那个错误是由于junit的jar包重复导致,让我们不要在”运行时配置项“的“Target Platform”里面选择com.springsource.junit,但是只操作这里还是不行,因为在unittest项目的元数据文件manifest.mf中定义了Require-Bundle: com.springsource.junit,所以如果你如果不勾选这个jar,元数据文件就会一直冒红,并且程序也测试不通过,所以还要这么做一下:将“Require-Bundle: com.springsource.junit”改为
Import-Package: junit.framework
因为导入com.springsource.junit包就是为了使用junit.framework ,而org.junit包里面也有junit.framework ,所以才会重复。
问题三:
在第378页至379页,将Eclipse JUnit Plug-in Test与Spring DM进行集成测试的时候,一直不成功,按照书上的做也不行,debug调试发现根本不走set方法,没有将HelloWorldService注入到实例中 ,不知道还要修改什么启动级别吗?有测试通过的,请告诉我一下。
相关文章推荐
- jQueryMobile开发时,遇到的一些问题记录
- 记录Android开发中遇到的一些问题
- JNI开发遇到的一些问题记录(持续记录更新)
- 数据库开发红皮书实例遇到的一些问题:“找不到可安装的ISAM” “BOF或EOF中有一个是'真',或者当前的记录已被删除……”
- Cocos2DX开发:记录遇到的一些问题和解决方法
- 记录arcgis JS api3.9开发过程中遇到的一些问题
- 记录开发中遇到的一些小问题和感悟
- VBA 开发中遇到的一些问题记录
- android开发遇到的一些问题,随手记录~
- jQueryMobile开发时,遇到的一些问题记录
- 最近我遇到的一些关于asp.net开发中的问题。。
- 安卓初级开发中遇到的一些问题
- 安卓开发遇到的一些问题(持续更新)
- 记录安卓模拟器 Genymotion 使用过程中遇到的一些问题
- 开发过程遇到的一些问题(一)
- cocos2d-x3.0rc打包apk遇到的一些问题记录
- web开发中经常遇到的一些乱码问题
- [项目过程中所遇到的各种问题记录]图表篇——有关MSChart的一些小技巧
- .Net开发工作中常遇到的一些问题及解决方案
- 开发chrome插件时遇到的一些问题