文档章节

ssh2全注解使用过程中遇到的错误

changda
 changda
发布于 2015/05/02 01:40
字数 1218
阅读 22
收藏 0
[ERROR][2015-05-02 01:31:48,301][org.springframework.web.context.ContextLoader]Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'baseDaoImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory mis.core.dao.BaseDaoImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [file:/D:/win7软件/javaEE/workSpace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/ooad-maven/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: mis.module.base.model.SaleOrderItem.SaleOrder in mis.module.base.model.SaleOrder.saleOrderItems
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:744)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory mis.core.dao.BaseDaoImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [file:/D:/win7软件/javaEE/workSpace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/ooad-maven/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: mis.module.base.model.SaleOrderItem.SaleOrder in mis.module.base.model.SaleOrder.saleOrderItems
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:514)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
	... 22 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [file:/D:/win7软件/javaEE/workSpace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/ooad-maven/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: mis.module.base.model.SaleOrderItem.SaleOrder in mis.module.base.model.SaleOrder.saleOrderItems
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486)
	... 24 more
Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: mis.module.base.model.SaleOrderItem.SaleOrder in mis.module.base.model.SaleOrder.saleOrderItems
	at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:708)
	at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:668)
	at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:69)
	at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1632)
	at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1390)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1777)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1861)
	at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:247)
	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:373)
	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:358)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
	... 34 more
五月 02, 2015 1:31:48 上午 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'baseDaoImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory mis.core.dao.BaseDaoImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [file:/D:/win7软件/javaEE/workSpace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/ooad-maven/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: mis.module.base.model.SaleOrderItem.SaleOrder in mis.module.base.model.SaleOrder.saleOrderItems
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:744)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory mis.core.dao.BaseDaoImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [file:/D:/win7软件/javaEE/workSpace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/ooad-maven/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: mis.module.base.model.SaleOrderItem.SaleOrder in mis.module.base.model.SaleOrder.saleOrderItems
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:514)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
	... 22 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [file:/D:/win7软件/javaEE/workSpace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/ooad-maven/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: mis.module.base.model.SaleOrderItem.SaleOrder in mis.module.base.model.SaleOrder.saleOrderItems
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486)
	... 24 more
Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: mis.module.base.model.SaleOrderItem.SaleOrder in mis.module.base.model.SaleOrder.saleOrderItems
	at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:708)
	at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:668)
	at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:69)
	at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1632)
	at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1390)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1777)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1861)
	at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:247)
	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:373)
	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:358)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
	... 34 more

五月 02, 2015 1:31:48 上午 org.apache.catalina.core.StandardContext startInternal
严重: Error listenerStart
五月 02, 2015 1:31:48 上午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/ooad-maven] startup failed due to previous errors
五月 02, 2015 1:31:48 上午 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
五月 02, 2015 1:31:48 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/ooad-maven] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
五月 02, 2015 1:31:48 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/ooad-maven] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
五月 02, 2015 1:31:48 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/ooad-maven] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
五月 02, 2015 1:31:48 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
五月 02, 2015 1:31:48 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
五月 02, 2015 1:31:48 上午 org.apache.catalina.startup.Catalina start
信息: Server startup in 5600 ms

注意该log中最重要的一点:

mappedBy reference an unknown target entity property: mis.module.base.model.SaleOrderItem.SaleOrder in mis.module.base.model.SaleOrder.saleOrderItems

即提示

mis.module.base.model.SaleOrderItem.SaleOrder
mis.module.base.model.SaleOrder.saleOrderItems

这里错了。

@OneToMany(fetch = FetchType.LAZY, mappedBy = "SaleOrder")
	public Set<SaleOrderItem> getSaleOrderItems() {
		return saleOrderItems;
	}
	public void setSaleOrderItems(Set<SaleOrderItem> saleOrderItems) {
		this.saleOrderItems = saleOrderItems;
	}

上述mappedBy=应该是SaleOrderItem中的SaleOrder对象,下面贴出SaleOrderItem中的域。

private int id;
	private SaleOrder saleOrder;
	private Product product;
	private int quantity;
	private double price;

上面代码中SaleOrder对象为saleOrder,所以mappedBy应该为"saleOrder",而不是类名"SaleOrder"

© 著作权归作者所有

共有 人打赏支持
changda

changda

粉丝 6
博文 12
码字总数 13118
作品 0
揭阳
在Solaris服务器上启动carte.sh报错

使用SSH2连接到服务器后,进入kettle根目录后启动carte.sh报如下错误: $java -version java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14) $ls -l carte.sh -r......

蔡文祥
2015/03/14
275
6
[转]Spring MVC 3.0.5+Spring 3.0.5+MyBatis3.0.4全注...

第一章 Spring更新到3.0之后,其MVC框架加入了一个非常不错的东西——那就是REST。它的开放式特性,与Spring的无缝集成,以及Spring框架的优秀表现,使得现在很多公司将其作为新的系统开发框...

robinjiang
2012/10/18
0
1
将Hibernate Search集成进已有项目中,实现全文检索功能

本来是准备使用Lucene的但是新版本的API过于繁琐,最后还是决定使用Hibernate Search来实现全文检索。这篇博文以我以前做的博客为例来实现全文检索。 1、修改Hibernate配置文件,因为我的系统...

Harmel
2015/08/12
0
10
分析总结Spring管理Hibernate中Dao层访问数据库常用方式(附SSH的jar包)

上篇博客中已经讲解Spring配置数据源的常用的几种方式。接下来本篇博客继续讲解。配置完数据源,那Dao层是如何访问数据库呢? 基于最近的项目使用SSH2框架完成,分析总结Spring与Hibernate集...

晨曦之光
2012/08/22
566
0
Android 如何编写基于编译时注解的项目

本文已在CSDN《程序员》杂志刊登。 本文已授权微信公众号:鸿洋(hongyangAndroid)在微信公众号平台原创首发。 转载请标明出处: http://blog.csdn.net/lmj623565791/article/details/5193...

lmj623565791
2016/07/20
0
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

配置Spring的注解支持

声明:本栏目所使用的素材都是凯哥学堂VIP学员所写,学员有权匿名,对文章有最终解释权;凯哥学堂旨在促进VIP学员互相学习的基础上公开笔记。 配置Spring的注解支持 以上也提到了使用注解来配...

凯哥学堂
42分钟前
0
0
关于Spring Aop存在的一点问题的思考

在本人前面的文章Spring Aop原理之切点表达式解析中讲解了Spring是如何解析切点表达式的,在分析源码的时候,出现了如下将要讲述的问题,我认为是不合理的,后来本人单纯使用aspectj进行试验...

爱宝贝丶
44分钟前
0
0
JavaScript 概述

JavaScript是面向Web的编程语言。绝大多数现代网站都使用了JavaScript,并且所有的现代Web浏览器——基于桌面系统、游戏机、平板电脑和智能手机的浏览器——均包含了JavaScript解释器。这使得...

Mr_ET
今天
0
0
Java Run-Time Data Areas(Java运行时数据区/内存分配)

Java运行时数据区(内存分配) 本文转载官网 更多相关内容可查看官网 中文翻译可参考 2.5. Run-Time Data Areas The Java Virtual Machine defines various run-time data areas that are use...

lichuangnk
今天
0
0
docker learn :services docker-compose.yml

docker-compose.yml定义了服务的运行参数 version: "3" services: web: # replace username/repo:tag with your name and image details image: hub.c.163.com/dog948453219/friendlyhello d......

writeademo
今天
0
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部