gpt4 book ai didi

hibernate - Grails 3.3.4在运行应用程序时出错

转载 作者:行者123 更新时间:2023-12-02 13:50:24 24 4
gpt4 key购买 nike

我正在尝试将我的应用程序从grails 3.2.11升级到3.3.4
在执行grails run-app时,我遇到了以下错误:

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:271) ... 49 common frames omitted Caused by: java.lang.NullPointerException: null at org.grails.orm.hibernate.cfg.GrailsDomainBinder.getTableName(GrailsDomainBinder.java:1202) at org.grails.orm.hibernate.cfg.GrailsDomainBinder.calculateTableForMany(GrailsDomainBinder.java:1155) at org.grails.orm.hibernate.cfg.GrailsDomainBinder.bindCollectionTable(GrailsDomainBinder.java:1105) at org.grails.orm.hibernate.cfg.GrailsDomainBinder.bindCollection(GrailsDomainBinder.java:1052) at org.grails.orm.hibernate.cfg.GrailsDomainBinder$CollectionType$1.create(GrailsDomainBinder.java:3463) at org.grails.orm.hibernate.cfg.GrailsDomainBinder.createClassProperties(GrailsDomainBinder.java:1872) at org.grails.orm.hibernate.cfg.GrailsDomainBinder.bindRootPersistentClassCommonValues(GrailsDomainBinder.java:1751) at org.grails.orm.hibernate.cfg.GrailsDomainBinder.bindRoot(GrailsDomainBinder.java:1391) at org.grails.orm.hibernate.cfg.GrailsDomainBinder.contribute(GrailsDomainBinder.java:165) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:275) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83) at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418) at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:692) at org.grails.orm.hibernate.cfg.HibernateMappingContextConfiguration.buildSessionFactory(HibernateMappingContextConfiguration.java:276) at org.grails.orm.hibernate.connections.HibernateConnectionSourceFactory.create(HibernateConnectionSourceFactory.java:86) at org.grails.orm.hibernate.connections.AbstractHibernateConnectionSourceFactory.create(AbstractHibernateConnectionSourceFactory.java:39) at org.grails.orm.hibernate.connections.AbstractHibernateConnectionSourceFactory.create(AbstractHibernateConnectionSourceFactory.java:23) at org.grails.datastore.mapping.core.connections.AbstractConnectionSourceFactory.create(AbstractConnectionSourceFactory.java:64) at org.grails.datastore.mapping.core.connections.AbstractConnectionSourceFactory.create(AbstractConnectionSourceFactory.java:52) at org.grails.datastore.mapping.core.connections.ConnectionSourcesInitializer.create(ConnectionSourcesInitializer.groovy:24) at org.grails.orm.hibernate.HibernateDatastore.(HibernateDatastore.java:204) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:1076) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142) ... 51 common frames omitted



有人对它有任何想法吗?

最佳答案

我调查了这个问题,不幸的是,这是对mapWith静态属性的不正确使用。问题实际上不是mapWith属性,而是您在一个非持久类上有一个hasMany,因为它不受支持。

虽然这可能以前已经起作用(已通过Gorm 6.0.x验证了您描述的行为在3.2.13之前可以正常工作),但它不是一项功能,但在具有Gorm 6.1.x的Grails 3.3.x中不起作用,因为诸如hasMany之类的关系将不起作用与非持久类一起工作。

删除mapWith似乎可以使其像以前的版本一样工作,并且似乎不会引起问题(您的里程可能会有所不同)。您还可以删除关系,这也可以使您摆脱错误。同样,关系是为持久对象设计的,因此最好考虑进行一些域更新。

关于hibernate - Grails 3.3.4在运行应用程序时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49814601/

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