异常:Cannot create ConcurrentHashMap - neither JDK 1.5 nor backport-concurrent available on ……

             异常:Cannot create ConcurrentHashMap - neither JDK 1.5 nor backport-concurrent available on the classpath

1:异常信息

!SESSION 2017-05-20 16:22:14.294 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_73
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=zh_CN
Command-line arguments:  -dev file:D:/AppData/eclipse-workspace/.metadata/.plugins/org.eclipse.pde.core/Spring/dev.properties -os win32 -ws win32 -arch x86 -consoleLog -console

!ENTRY org.springframework.osgi.extender 4 0 2017-05-20 16:22:14.890
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Error starting module.
	at org.eclipse.osgi.container.Module.doStart(Module.java:580)
	at org.eclipse.osgi.container.Module.start(Module.java:439)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Caused by: java.lang.IllegalStateException: Cannot create ConcurrentHashMap - neither JDK 1.5 nor backport-concurrent available on the classpath
	at org.springframework.core.CollectionFactory.createConcurrentMap(CollectionFactory.java:229)
	at org.springframework.osgi.extender.internal.activator.ContextLoaderListener.<init>(ContextLoaderListener.java:332)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.loadBundleActivator(BundleContextImpl.java:755)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:706)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319)
	at org.eclipse.osgi.container.Module.doStart(Module.java:571)
	... 8 more
Root exception:
java.lang.IllegalStateException: Cannot create ConcurrentHashMap - neither JDK 1.5 nor backport-concurrent available on the classpath
	at org.springframework.core.CollectionFactory.createConcurrentMap(CollectionFactory.java:229)
	at org.springframework.osgi.extender.internal.activator.ContextLoaderListener.<init>(ContextLoaderListener.java:332)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.loadBundleActivator(BundleContextImpl.java:755)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:706)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319)
	at org.eclipse.osgi.container.Module.doStart(Module.java:571)
	at org.eclipse.osgi.container.Module.start(Module.java:439)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY org.eclipse.osgi 4 0 2017-05-20 16:22:14.925
!MESSAGE Bundle org.springframework.osgi.extender_1.2.1 [1] is not active.
osgi> 

2:异常描述

     使用Spring框架和OSGi框架搭建环境(参考:http://www.osgi.com.cn/article/7289459)时出现如上异常,Spring-DM(Spring-DM指的是 Spring Dynamic Modules。Spring-DM 的主要目的是能够方便地将 Spring 框架和OSGi框架结合在一起,使得使用Spring的应用程序可以方便简单地部署在OSGi环境中,利用OSGi框架提供的服务,将应用变得更加模块化。的版本:1.2.1

3:解决办法

查看spring-osgi-core-1.2.1的MANIFEST.MF文件,发现构建JDK为1.5.0__22,

Bundle-Version: 1.2.1
Bundle-Description: Spring/OSGi core classes. Offers OSGi-based applic
 ation context and importer/exporter functionality.
Bundle-Name: spring-osgi-core
Bundle-Classpath: .
Build-Jdk: 1.5.0_22
Bundle-DocURL: http://www.springframework.org/osgi
Spring-Version: 2.5.6.SEC01
Bundle-Vendor: SpringSource
Bundle-ManifestVersion: 2
Implementation-Title: Spring Dynamic Modules Framework
Bundle-SymbolicName: org.springframework.osgi.core
Implementation-Version: 1.2.1
Implementation-Vendor: SpringSource

而本地运行JDK为:1.8.0_73Spring-DM版本与JDK不兼容,把运行JDK改为1.6后,问题解决!



参考:http://stackoverflow.com/questions/27173641/spring-dm-compatibility-with-spring-4

       

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值