gpt4 book ai didi

hibernate - java.lang.ClassNotFoundException:org.hibernate.cfg.Mappings

转载 作者:行者123 更新时间:2023-12-02 14:10:32 25 4
gpt4 key购买 nike

运行Grails 3应用程序时出现以下异常。我知道休眠版本5.1.0.Final没有这个类,但是我需要使用这个版本。但是spring-boot要求这个Mappings类。如何解决呢?

    2016-03-13 00:48:09,355 30464 ERROR [main] [org.apache.commons.logging.Log$error$1] WARNING: You've configured a custom Hibernate naming strategy 'class org.hibernate.cfg.ImprovedNamingStrategy' in DataSource.groovy, however the class cannot be found.
Using Grails' default naming strategy: 'org.hibernate.cfg.ImprovedNamingStrategy'
2016-03-13 00:48:09,534 30643 ERROR [main] [org.springframework.boot.SpringApplication] Application startup failed
java.lang.NoClassDefFoundError: org/hibernate/cfg/Mappings
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.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredMethods(ReflectiveInterceptor.java:153)
at org.codehaus.groovy.reflection.stdclasses.CachedSAMClass$1.run(CachedSAMClass.java:104)
at org.codehaus.groovy.reflection.stdclasses.CachedSAMClass$1.run(CachedSAMClass.java:102)
at java.security.AccessController.doPrivileged(Native Method)
at org.codehaus.groovy.reflection.stdclasses.CachedSAMClass.getDeclaredMethods(CachedSAMClass.java:102)
at org.codehaus.groovy.reflection.stdclasses.CachedSAMClass.getAbstractMethods(CachedSAMClass.java:120)
at org.codehaus.groovy.reflection.stdclasses.CachedSAMClass.getSAMMethod(CachedSAMClass.java:186)
at org.codehaus.groovy.reflection.ClassInfo.isSAM(ClassInfo.java:359)
at org.codehaus.groovy.reflection.ClassInfo.createCachedClass(ClassInfo.java:349)
at org.codehaus.groovy.reflection.ClassInfo.access$700(ClassInfo.java:41)
at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue(ClassInfo.java:497)
at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue(ClassInfo.java:488)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:49)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:36)
at org.codehaus.groovy.reflection.ClassInfo.getCachedClass(ClassInfo.java:111)
at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:110)
at org.codehaus.groovy.reflection.CachedClass$4.initValue(CachedClass.java:141)
at org.codehaus.groovy.reflection.CachedClass$4.initValue(CachedClass.java:138)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:49)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:36)
at org.codehaus.groovy.reflection.CachedClass.getCachedSuperClass(CachedClass.java:248)
at org.codehaus.groovy.reflection.CachedClass$8.initValue(CachedClass.java:214)
at org.codehaus.groovy.reflection.CachedClass$8.initValue(CachedClass.java:200)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:49)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:36)
at org.codehaus.groovy.reflection.CachedClass.getInterfaces(CachedClass.java:252)
at org.codehaus.groovy.reflection.CachedClass.<init>(CachedClass.java:238)
at org.codehaus.groovy.reflection.ClassInfo.createCachedClass(ClassInfo.java:352)
at org.codehaus.groovy.reflection.ClassInfo.access$700(ClassInfo.java:41)
at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue(ClassInfo.java:497)
at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue(ClassInfo.java:488)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:49)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:36)
at org.codehaus.groovy.reflection.ClassInfo.getCachedClass(ClassInfo.java:111)
at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:110)
at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:180)
at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:216)
at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:228)
at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:171)
at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(MetaClassRegistry.java:161)
at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:144)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:253)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:285)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:257)
at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:877)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:75)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:162)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at grails.orm.bootstrap.HibernateDatastoreSpringInitializer$_getBeanDefinitions_closure1.doCall(HibernateDatastoreSpringInitializer.groovy:225)
at grails.orm.bootstrap.HibernateDatastoreSpringInitializer$_getBeanDefinitions_closure1.doCall(HibernateDatastoreSpringInitializer.groovy)
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.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
at groovy.lang.Closure.call(Closure.java:426)
at groovy.lang.Closure.call(Closure.java:420)
at grails.plugin.hibernate.HibernateGrailsPlugin$_doWithSpring_closure1.doCall(HibernateGrailsPlugin.groovy:81)
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.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
at groovy.lang.Closure.call(Closure.java:426)
at groovy.lang.Closure.call(Closure.java:420)
at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:758)
at grails.spring.BeanBuilder.beans(BeanBuilder.java:588)
at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:531)
at org.grails.plugins.DefaultGrailsPlugin.doWithRuntimeConfiguration(DefaultGrailsPlugin.java:559)
at org.grails.plugins.AbstractGrailsPluginManager.doRuntimeConfiguration(AbstractGrailsPluginManager.java:172)
at grails.boot.config.GrailsApplicationPostProcessor.postProcessBeanDefinitionRegistry(GrailsApplicationPostProcessor.groovy:157)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:123)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:678)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:520)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at grails.boot.GrailsApp.run(GrailsApp.groovy:51)
at grails.boot.GrailsApp.run(GrailsApp.groovy:335)
at grails.boot.GrailsApp.run(GrailsApp.groovy:324)
at grails.boot.GrailsApp$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at com.asklytics.mlaas.jmeter.Application.main(Application.groovy:11)
Caused by: java.lang.ClassNotFoundException: org.hibernate.cfg.Mappings
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 99 common frames omitted

最佳答案

我将休眠状态从4更新为5。看到此链接以更新grails中的休眠How to configure Grails 3.1.1 to use Hibernate 5

关于hibernate - java.lang.ClassNotFoundException:org.hibernate.cfg.Mappings,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35962878/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com