出现如下错误,怎么解决--我用的是hibernate-release-5.2.5.Final

来源:1-11 通过Hibernate API编写访问数据库的代码

慕粉1410068849

2016-12-17 18:51

java.lang.UnsupportedClassVersionError: org/hibernate/SessionFactory : Unsupported major.minor version 52.0

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClass(ClassLoader.java:800)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)

at java.net.URLClassLoader.access$100(URLClassLoader.java:71)

at java.net.URLClassLoader$1.run(URLClassLoader.java:361)

at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

at java.lang.ClassLoader.loadClass(ClassLoader.java:425)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

at java.lang.Class.getDeclaredFields0(Native Method)

at java.lang.Class.privateGetDeclaredFields(Class.java:2499)

at java.lang.Class.getDeclaredFields(Class.java:1811)

at org.junit.runners.model.TestClass.<init>(TestClass.java:44)

at org.junit.runners.ParentRunner.<init>(ParentRunner.java:73)

at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:55)

at org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:13)

at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)

at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


写回答 关注

2回答

  • 慕雪6888549
    2017-04-24 19:23:33
    hibernate5版本导入这个包
    import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
    4版本导入
    import org.hibernate.service.StandardServiceRegistryBuilder;


  • qq_沉璧_04003293
    2016-12-18 11:41:39

    可能是jdk版本不对,换个jdk运行试试


Hibernate初探之单表映射

Java持久化框架Hibernate入门教程,掌握Hibernate基本概念

74808 学习 · 793 问题

查看课程

相似问题