zoukankan      html  css  js  c++  java
  • …… are only available on JDK 1.5 and higher 错误

    "C:Program FilesJavajdk1.8.0_73injava" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:D:softwaresideaIntelliJ IDEA 2017.1libidea_rt.jar=65398:D:softwaresideaIntelliJ IDEA 2017.1in" -Dfile.encoding=UTF-8 -classpath "D:softwaresideaIntelliJ IDEA 2017.1libidea_rt.jar;D:softwaresideaIntelliJ IDEA 2017.1pluginsjunitlibjunit-rt.jar;F:IntelliJProjectSSH2WebRootWEB-INFclasses;D:softwaresideaIntelliJ IDEA 2017.1libjunit-4.12.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibantlr-2.7.6.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibaspectjrt.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibaspectjweaver.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibc3p0-0.9.1.2.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibcglib-nodep-2.1_3.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibcommon-annotations.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibcommons-collections-3.1.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibcommons-fileupload-1.2.1.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibcommons-logging-1.0.4.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibcommons-logging.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibdom4j-1.6.1.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibehcache-1.2.3.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibejb3-persistence.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibfreemarker-2.3.15.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibhibernate-annotations.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibhibernate-cglib-repack-2.1_3.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibhibernate-commons-annotations.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibhibernate-entitymanager.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibhibernate3.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibjavassist-3.4.GA.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibjstl.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibjta-1.1.jar;F:IntelliJProjectSSH2WebRootWEB-INFliblog4j-1.2.15.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibmysql-connector-java-3.1.13-bin.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibognl-2.7.3.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibslf4j-api-1.5.2.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibslf4j-log4j12.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibspring.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibstandard.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibstruts2-core-2.1.8.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibstruts2-spring-plugin-2.1.8.jar;F:IntelliJProjectSSH2WebRootWEB-INFlibxwork-core-2.1.6.jar;F:sshSSH2junit-4.8.2.jar;C:Program FilesJavajdk1.8.0_73jrelibcharsets.jar;C:Program FilesJavajdk1.8.0_73jrelibdeploy.jar;C:Program FilesJavajdk1.8.0_73jrelibextaccess-bridge-64.jar;C:Program FilesJavajdk1.8.0_73jrelibextcldrdata.jar;C:Program FilesJavajdk1.8.0_73jrelibextdnsns.jar;C:Program FilesJavajdk1.8.0_73jrelibextjaccess.jar;C:Program FilesJavajdk1.8.0_73jrelibextjfxrt.jar;C:Program FilesJavajdk1.8.0_73jrelibextlocaledata.jar;C:Program FilesJavajdk1.8.0_73jrelibext ashorn.jar;C:Program FilesJavajdk1.8.0_73jrelibextsunec.jar;C:Program FilesJavajdk1.8.0_73jrelibextsunjce_provider.jar;C:Program FilesJavajdk1.8.0_73jrelibextsunmscapi.jar;C:Program FilesJavajdk1.8.0_73jrelibextsunpkcs11.jar;C:Program FilesJavajdk1.8.0_73jrelibextzipfs.jar;C:Program FilesJavajdk1.8.0_73jrelibjavaws.jar;C:Program FilesJavajdk1.8.0_73jrelibjce.jar;C:Program FilesJavajdk1.8.0_73jrelibjfr.jar;C:Program FilesJavajdk1.8.0_73jrelibjfxswt.jar;C:Program FilesJavajdk1.8.0_73jrelibjsse.jar;C:Program FilesJavajdk1.8.0_73jrelibmanagement-agent.jar;C:Program FilesJavajdk1.8.0_73jrelibplugin.jar;C:Program FilesJavajdk1.8.0_73jrelib esources.jar;C:Program FilesJavajdk1.8.0_73jrelib t.jar;F:IntelliJProjectSSH2junit-4.8.2.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 junit.test.EmployeeTest,list
    log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
    log4j:WARN Please initialize the log4j system properly.
    org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [beans.xml]; nested exception is java.lang.IllegalStateException: Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
    at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
    at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:80)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    at junit.test.EmployeeTest.setUpBeforeClass(EmployeeTest.java:20)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
    Caused by: java.lang.IllegalStateException: Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] 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 org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1297)
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
    ... 28 more

    java.lang.NullPointerException
    at junit.test.EmployeeTest.list(EmployeeTest.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)


    Process finished with exit code -1

    1、在项目中创建一个package为org.springframework.core 
    2、在该package下面新建JdkVersion.java,内容如下:

    package org.springframework.core;
    
    public abstract class JdkVersion {
        public static final int JAVA_13 = 0;
        public static final int JAVA_14 = 1;
        public static final int JAVA_15 = 2;
        public static final int JAVA_16 = 3;
        public static final int JAVA_17 = 4;
        //for jre 1.8
        public static final int JAVA_18 = 5;
        private static final String javaVersion = System
                .getProperty("java.version");
        private static final int majorJavaVersion;
        public static String getJavaVersion() {
            return javaVersion;
        }
        public static int getMajorJavaVersion() {
            return majorJavaVersion;
        }
        public static boolean isAtLeastJava14() {
            return true;
        }
        public static boolean isAtLeastJava15() {
            return getMajorJavaVersion() >= 2;
        }
        public static boolean isAtLeastJava16() {
            return getMajorJavaVersion() >= 3;
        }
        static {
            //for jre 1.8
            if (javaVersion.indexOf("1.8.") != -1) {
                majorJavaVersion = 5;
            }else 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;
            }
        }
    }

    3、到项目的WEB-INF/classes 下面找到对应的package中的JdkVersion.class文件 

    4、将项目中的spring-core-2.5.6.jar拷贝出来打开,然后将JdkVersion.class替换jar包中的该文件。 
    5、将修改后的spring-core-2.5.6.jar再覆盖到项目中。

    我是在第二步加入代码再次运行就OK了!

  • 相关阅读:
    Django在新浪SAE中使用storage服务实现文件上传保存
    安装mysql5.1.30时mysql_install_db出现FATAL ERROR: Could not find mysqld错误解决
    Ubuntu下的负载均衡Web集群配置
    ERROR 2002 (HY000): Can't connect to local MySQL server through so...
    Ubuntu下的C/C++环境搭建
    php linux sphinx 安装
    sphinx安装步骤
    Ubuntu下vmwaretools安装
    LAMP全新安装 Linux+Apache+MySQL+PHP+phpMyadmin+Zend
    ubuntu 彻底删除MySQL数据库实操
  • 原文地址:https://www.cnblogs.com/hoobey/p/7299268.html
Copyright © 2011-2022 走看看