Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.orm.hibernate5.LocalSessionFactoryBean] from ClassLoader [sun.misc.Launcher$AppClassLoader@b4aac2] at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:659) at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:556) at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:541) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:245) ... 55 more Caused by: java.lang.NoClassDefFoundError: org/hibernate/service/ServiceRegistry at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.getDeclaredMethods(Class.java:1975) at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:641) ... 58 more Caused by: java.lang.ClassNotFoundException: org.hibernate.service.ServiceRegistry at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 62 more
hibernate5.LocalSessionFactoryBean用到了ServiceRegistry。
解决办法:将hibernate的core包改为hibernate3。hibernate的包版本问题。
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.orm.hibernate5.LocalSessionFactoryBean] from ClassLoader [sun.misc.Launcher$AppClassLoader@b4aac2]at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:659)at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:556)at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:541)at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:245)... 55 moreCaused by: java.lang.NoClassDefFoundError: org/hibernate/service/ServiceRegistryat java.lang.Class.getDeclaredMethods0(Native Method)at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)at java.lang.Class.getDeclaredMethods(Class.java:1975)at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:641)... 58 moreCaused by: java.lang.ClassNotFoundException: org.hibernate.service.ServiceRegistryat java.net.URLClassLoader.findClass(URLClassLoader.java:381)at java.lang.ClassLoader.loadClass(ClassLoader.java:424)at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)at java.lang.ClassLoader.loadClass(ClassLoader.java:357)... 62 more