spring 2.5.6 错误:Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher
在运行一个第三方公司交付的项目的时候, 出现:
Caused by: java.lang.IllegalStateException: Context namespace element 'annotation-config' and its parser class [org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser] are only available on JDK 1.5 and higher
at org.springframework.context.config.ContextNamespaceHandler$1.parse(ContextNamespaceHandler.java:65)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
at
凭感觉,这是jdk版本问题。 我本机安装的是1.8, 对方要求的也是1.8. 他们运行没问题,我这里怎么就不行了呢? 这就奇怪了。。
跟进源码里面看看吧: org.springframework.context.config.ContextNamespaceHandler$1.parse(ContextNamespaceHandler.java:65)
private void registerJava5DependentParser(final String elementName, final String parserClassName) {
BeanDefinitionParser parser = null;
if(JdkVersion.isAtLeastJava15()) {
try {
Class parserClass = ClassUtils.forName(parserClassName, ContextNamespaceHandler.class.getClassLoader());
parser = (BeanDefinitionParser)parserClass.newInstance();
} catch (Throwable var5) {
throw new IllegalStateException("Unable to create Java 1.5 dependent parser: " + parserClassName, var5);
}
} else {
parser = new BeanDefinitionParser() {
public BeanDefinition parse(Element element, ParserContext parserContext) {
throw new IllegalStateException("Context namespace element '" + elementName + "' and its parser class [" + parserClassName + "] are only available on JDK 1.5 and higher");
}
};
}
很明显是JdkVersion.isAtLeastJava15() 有蹊跷:
public static boolean isAtLeastJava15() {
return getMajorJavaVersion() >= 2;
}
最后找到:
static {
if(javaVersion.indexOf("1.7.") != -1) {
majorJavaVersion = 4;
} else if(javaVersion.indexOf("1.6.") != -1) {
majorJavaVersion = 3;
} else if(javaVersion.indexOf("1.5.") != -1) {
majorJavaVersion = 2;
} else {
majorJavaVersion = 1;
}
}
原来如此,这个版本的spring(2.5.6) 只能支持到 1.7, 估计当时1.8 没有出来(什么年代了还用2.5.6,真是奇葩啊)。怎么办呢?需要重新安装一个低版本的jdk啊
另外注意到:
private static final String javaVersion = System.getProperty("java.version");
还需要,修改 java的 环境变量,不然还是不生效。
spring 2.5.6 错误:Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher的更多相关文章
- Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher
异常信息如下: 错误: Unexpected exception parsing XML document from class path resource [spring/applicationCo ...
- 【原创】大叔经验分享(16)Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher
今天尝试运行一个古老的工程,配置好之后编译通过,结果运行时报错: org.springframework.beans.factory.BeanDefinitionStoreException: Une ...
- class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher
在搭建SSM项目时报了以下的错误: 06-Oct-2019 11:55:52.109 信息 [RMI TCP Connection(5)-127.0.0.1] org.apache.catalina. ...
- [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher 问题--MyEclipse设置JDK版本
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML doc ...
- spring低版本报错:java.lang.IllegalStateException: Context namespace element ‘annotation-config’ and its parser class [*] are only available on
参考来源:http://blog.csdn.net/sunxiaoyu94/article/details/50492083 使用spring低版本(2.5.6),使用jre 8发现错误: Unexp ...
- nested exception is java.lang.IllegalStateException: Context namespace element 'annotation-config' a
公司还用的是spring低版本,今天用jre 8测试了一下,发现错误: Unexpected exception parsing XML document from class path resour ...
- Context namespace element 'annotation-config' and its parser class [org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser]
严重: Exception sending context initialized event to listener instance of class org.springframework.we ...
- Context namespace element 'annotation-config' and its parser class [org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser] are only available on JDK 1.5 and higher
Context namespace element 'annotation-config' and its parser class [org.springframework.context.anno ...
- …… are only available on JDK 1.5 and higher 错误
"C:\Program Files\Java\jdk1.8.0_73\bin\java" -ea -Didea.test.cyclic.buffer.size=1048576 &q ...
随机推荐
- 16.python-I/O模型
一.事件驱动模型1.什么是事件驱动模型:本身是一种编程范式,这里程序的执行是由外部事件来决定的.它的特点是包含一个事件循环,当外部事件发生时使用回调机制来触发相应的处理.常见的编程范式(单线程)同步以 ...
- js的组成部分
ECMAScript js基本语法与标准 DOM Document Object Model文档对象模型 BOM Browser Object Model浏览器对象模型
- 让你真正了解Java(纯干货)
“你学习一门技术的最佳时机是三年前,其次是现在.”这句话对于哪一种行业都很适用,如果你已经学习过Java,那么恭喜你你很有先见之明,如果你并不了解Java,这篇文章带你快速掌握Java的几个核心知识点 ...
- sklearn learn preprocessing
train_test_split sklearn.model_selection.train_test_split(*arrays, test_size(float,int/None),#defaul ...
- canvas绘制环形进度条
<!DOCTYPE html> <html > <head> <meta http-equiv="content-type" conten ...
- etectMultiScale(gray, 1.2,3,CV_HAAR_SCALE_IMAGE,Size(30, 30))
# 函数原型detectMultiScale(gray, 1.2,3,CV_HAAR_SCALE_IMAGE,Size(30, 30)) # gray需要识别的图片 # 1.03:表示每次图像尺寸减小 ...
- Oracle开启监听缓慢问题
现象: Oracle数据库中,使用lsnrctl开启.关闭监听或查看监听状态时,非常慢,可以通过断网的方式使动作马上完成. 在客户端使用plsql等方式连接数据库时,也是非常慢,同样也可以通过切换网络 ...
- sqlserver 表操作 SQL篇
数据库知识点 1.数据库操作: 增:insert into 表名 values(值1,值2,值3) 删:delete 列名 from 表名 where 条件 改:update 表名 set =值 wh ...
- DataGrip for Mac破解步骤详解 亲测好用
https://blog.csdn.net/le945926/article/details/81912085
- Windows batch file
Echo off @ECHO OFF echo string to generate the output create a blank line echo . create a file echo ...