未知的持久性实体错误".升级到3.0.1.之后 [英] Unknown persistent entity Error" after upgrade to 3.0.1.Release

查看:81
本文介绍了未知的持久性实体错误".升级到3.0.1.之后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近升级到Spring Neo4j 3.0.1.Release.我现在收到异常"MappingException:未知的持久性实体".不知道是什么原因导致的,因为我没有对应用程序进行任何更改.

Recently upgraded to Spring Neo4j 3.0.1.Release. I am now getting an Exception "MappingException: Unknown persistent entity". Not sure what could be causing this as I have not made any changes to the application.

我创建了一个小型测试项目来重新创建错误消息.您可以从此处下载- http://www.filebin.ca/1S2rAXPJE199/Store.zip

I have created a small test project to recreate the error message. You can download it from here - http://www.filebin.ca/1S2rAXPJE199/Store.zip

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.base.store.repository.AccountRepository com.base.store.service.impl.AccountServiceImpl.accountRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.model.MappingException: Unknown persistent entity com.base.store.Account
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
    at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:84)
    at com.base.crossstore.AccountTester.main(AccountTester.java:13)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.base.store.repository.AccountRepository com.base.store.service.impl.AccountServiceImpl.accountRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.model.MappingException: Unknown persistent entity com.base.store.Account
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:508)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)
    ... 12 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.model.MappingException: Unknown persistent entity com.base.store.Account
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1017)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:960)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:858)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:480)
    ... 14 more
Caused by: org.springframework.data.mapping.model.MappingException: Unknown persistent entity com.base.store.Account
    at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:178)
    at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:141)
    at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:67)
    at org.springframework.data.neo4j.repository.query.CypherQueryBuilder.<init>(CypherQueryBuilder.java:37)
    at org.springframework.data.neo4j.repository.query.CypherQueryCreator.create(CypherQueryCreator.java:72)
    at org.springframework.data.neo4j.repository.query.CypherQueryCreator.create(CypherQueryCreator.java:35)
    at org.springframework.data.repository.query.parser.AbstractQueryCreator.createCriteria(AbstractQueryCreator.java:109)
    at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:88)
    at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:73)
    at org.springframework.data.neo4j.repository.query.DerivedCypherRepositoryQuery.<init>(DerivedCypherRepositoryQuery.java:59)
    at org.springframework.data.neo4j.repository.query.GraphQueryMethod.createQuery(GraphQueryMethod.java:146)
    at org.springframework.data.neo4j.repository.GraphRepositoryFactory$1.resolveQuery(GraphRepositoryFactory.java:113)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:320)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:169)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:224)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:210)
    at org.springframework.data.neo4j.repository.GraphRepositoryFactoryBean.afterPropertiesSet(GraphRepositoryFactoryBean.java:69)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
    ... 24 more

推荐答案

最终设法上班了.我从@Configuration类中删除了@Bean neo4jMappingContext(),然后通过构造函数调用setBasePackage('..').

Finally managed to get to work. I deleted the @Bean neo4jMappingContext() from @Configuration Class, then calling setBasePackage('..') via Constructor.

这篇关于未知的持久性实体错误".升级到3.0.1.之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆