今天运行一个14年基于spring2.5的项目,出现下面错误

Unexpected exception parsing XML document from class path resource ...............

Context namespace element 'component-scan' and its parser class [org.springframework.core........

解决方法,在项目中创建下面的类,运行即可消除该错误

  1. /*
  2. * Copyright 2002-2007 the original author or authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16.  
  17. package org.springframework.core;
  18.  
  19. /**
  20. * Internal helper class used to find the Java/JDK version
  21. * that Spring is operating on, to allow for automatically
  22. * adapting to the present platform's capabilities.
  23. *
  24. * <p>Note that Spring requires JVM 1.4 or higher, as of Spring 2.5.
  25. *
  26. * @author Rod Johnson
  27. * @author Juergen Hoeller
  28. * @author Rick Evans
  29. */
  30. public abstract class JdkVersion {
  31.  
  32. /**
  33. * Constant identifying the 1.3.x JVM (JDK 1.3).
  34. */
  35. public static final int JAVA_13 = 0;
  36.  
  37. /**
  38. * Constant identifying the 1.4.x JVM (J2SE 1.4).
  39. */
  40. public static final int JAVA_14 = 1;
  41.  
  42. /**
  43. * Constant identifying the 1.5 JVM (Java 5).
  44. */
  45. public static final int JAVA_15 = 2;
  46.  
  47. /**
  48. * Constant identifying the 1.6 JVM (Java 6).
  49. */
  50. public static final int JAVA_16 = 3;
  51.  
  52. /**
  53. * Constant identifying the 1.7 JVM (Java 7).
  54. */
  55. public static final int JAVA_17 = 4;
  56. public static final int JAVA_18 = 4;
  57.  
  58. private static final String javaVersion;
  59.  
  60. private static final int majorJavaVersion;
  61.  
  62. static {
  63. javaVersion = System.getProperty("java.version");
  64. // version String should look like "1.4.2_10"
  65. if(javaVersion.indexOf("1.8.") != -1){
  66. majorJavaVersion = JAVA_18;
  67. }else if (javaVersion.indexOf("1.7.") != -1) {
  68. majorJavaVersion = JAVA_17;
  69. }
  70. else if (javaVersion.indexOf("1.6.") != -1) {
  71. majorJavaVersion = JAVA_16;
  72. }
  73. else if (javaVersion.indexOf("1.5.") != -1) {
  74. majorJavaVersion = JAVA_15;
  75. }
  76. else {
  77. // else leave 1.4 as default (it's either 1.4 or unknown)
  78. majorJavaVersion = JAVA_14;
  79. }
  80. }
  81.  
  82. /**
  83. * Return the full Java version string, as returned by
  84. * <code>System.getProperty("java.version")</code>.
  85. * @return the full Java version string
  86. * @see System#getProperty(String)
  87. */
  88. public static String getJavaVersion() {
  89. return javaVersion;
  90. }
  91.  
  92. /**
  93. * Get the major version code. This means we can do things like
  94. * <code>if (getMajorJavaVersion() < JAVA_14)</code>.
  95. * @return a code comparable to the JAVA_XX codes in this class
  96. * @see #JAVA_13
  97. * @see #JAVA_14
  98. * @see #JAVA_15
  99. * @see #JAVA_16
  100. * @see #JAVA_17
  101. */
  102. public static int getMajorJavaVersion() {
  103. return majorJavaVersion;
  104. }
  105.  
  106. /**
  107. * Convenience method to determine if the current JVM is at least Java 1.4.
  108. * @return <code>true</code> if the current JVM is at least Java 1.4
  109. * @see #getMajorJavaVersion()
  110. * @see #JAVA_14
  111. * @see #JAVA_15
  112. * @see #JAVA_16
  113. * @see #JAVA_17
  114. */
  115. public static boolean isAtLeastJava14() {
  116. return true;
  117. }
  118.  
  119. /**
  120. * Convenience method to determine if the current JVM is at least
  121. * Java 1.5 (Java 5).
  122. * @return <code>true</code> if the current JVM is at least Java 1.5
  123. * @see #getMajorJavaVersion()
  124. * @see #JAVA_15
  125. * @see #JAVA_16
  126. * @see #JAVA_17
  127. */
  128. public static boolean isAtLeastJava15() {
  129. return getMajorJavaVersion() >= JAVA_15;
  130. }
  131.  
  132. /**
  133. * Convenience method to determine if the current JVM is at least
  134. * Java 1.6 (Java 6).
  135. * @return <code>true</code> if the current JVM is at least Java 1.6
  136. * @see #getMajorJavaVersion()
  137. * @see #JAVA_16
  138. * @see #JAVA_17
  139. */
  140. public static boolean isAtLeastJava16() {
  141. return getMajorJavaVersion() >= JAVA_16;
  142. }
  143.  
  144. }

spring2.5 jdk1.8的更多相关文章

  1. Spring2.5与JDK8的集成问题

    Spring2.5不支持JDK8及其以上的版本,因为有一段校验JDK版本的代码,当JDK版本大于1.7之后,会识别成JDK1.4之前的.会报版本太低的错误. /* * Copyright 2002-2 ...

  2. Spring2.5整合Ibatis入门级开发实例

      分类: SPRING IBATIS2010-11-22 20:19 1170人阅读 评论(0) 收藏 举报 ibatisspringstringpropertiesclassuser 最近一直在看 ...

  3. JDK1.5以后的版本特性

    一.JDK1.5新特性 1.泛型:泛型的本质是参数化类型,也就是说所操作的数据类型被指定为一个参数.这种参数类型可以用在类.接口和方法的创建中,分别称为泛型类.泛型接口.泛型方法.可以在编译的时候就能 ...

  4. Java入门到精通——调错篇之Spring2.5利用aspect实现AOP时报错: error at ::0 can't find referenced pointcut XXX

    一.问题描述及原因. 利用Aspect注解实现AOP的时候出现了error at ::0 can't find referenced pointcut XXX.一看我以为注解写错了,结果通过查询相关资 ...

  5. Java入门到精通——调错篇之Spring2.5使用AOP时报错only available on JDK 1.5 and higher

    一.问题描述及原因. 在Spring2.5Aop例子中的时候会出现一个错误only available on JDK 1.5 and higher,大概意思就是需要JDK1.5甚至更高版本.但是我用的 ...

  6. CentOS安装JDK-1.7

    注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. #准备工作# 准备用rpm下载前,看系统是否已经安装有JDK,如果没有则进入正式安装步骤. # rpm -qa | grep jd ...

  7. ubuntu 14.04 配置 jdk1.8

    自己在Ubuntu中安装jdk1.8的步骤,记录以方便以后查询. 将下载好的jdk安装包移到/usr/local目录中(我喜欢将自己安装的软件放在/usr/local目录中),解压缩 sudo tar ...

  8. Linux下安装jdk1.7、Apache-tomcat7

    首先说明下我的主机环境:主机:32位win7 虚拟机:VMware Workstation10.0.1 linux:红帽子centos6.4 jdk1.7 Apache-tomcat7 java环境需 ...

  9. Linux配置JDK1.7和Resin4.0

    1.安装JDK1.7 (1)下载 官网下载路径:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-18802 ...

随机推荐

  1. test20190729 夏令营NOIP训练14

    40+100+0=140. 基因光线 黑大帅统治古古怪界后,一直在玩一种很奇葩的游戏.在一个二维平面上,他先复制了n个小A,把他们放在不同的位置,然后射出一条ax+by+c=0的基因光线,宽度为d,即 ...

  2. ASCII、Unicode、UTF-8字符集编码

    ASCII码 计算机内部,所有信息都是由二进制的字符串表示 每一个二进制位有“0”.“1”两种状态,因此8个二进制位可以表示256个状态,每个状态代表一个符号就是256个符号,从0000000到111 ...

  3. IntelliJ IDEA12的解决占用C盘C:\Users\Administrator

    在安装完IntelliJ IDEA之后,默认会在windows的系统盘用户文件夹中创建配置等文件.在我只有32G的SSD盘中,怎么能让它如此,不爽呀..占用到现在都快1G了.好吧.今天把她解决了. 找 ...

  4. 堆优化/zkw线段树优化 dijkstra

    #include <bits/stdc++.h> using namespace std; const int MAXN = 100005; const int MAXM = 200005 ...

  5. MySQL Innodb引擎调优

    介绍: Innodb给MYSQL提供了具有提交,回滚和崩溃恢复能力的事务安全(ACID兼容)存储引擎.Innodb锁定在行级并且也在SELECT语句提供一个Oracle风格一致的非锁定读.这些特色增加 ...

  6. 用LinkedList和ArrayList实现自定义栈的异同

    //ArrayList已连续的空间进行存储数据  //LinkedList已链表的结构存储数据    //栈  MyStark ms=new MyStark();//new 一个实现栈的类  //压栈 ...

  7. 使用session存储数据

    @WebServlet("/reply") public class ReplyServlet extends HttpServlet { @Override protected ...

  8. PDB符号文件浏览工具介绍

    一.SymView SymView工具用来显示符号文件中包含的符号表和符号数据.目前支持微软的Visual C/C++和C#编译器产生的DBG格式的符号文件和PDB格式的符号文件. SymView提供 ...

  9. 用es实现模糊搜索

    Haystack为Django提供了模块化的搜索.它的特点是统一的,熟悉的API,可以让你在不修改代码的情况下使用不同的搜索后端(比如 Solr, Elasticsearch, Whoosh, Xap ...

  10. 自主设计BootLoader框架笔记一栏