entity-SSH框架问题,怎么一直报这个错

问题描述

SSH框架问题,怎么一直报这个错

严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in file [D:toolsapache-tomcat-6.0.43webappsstudyWEB-INFclassesconfigspring-beans.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:toolsapache-tomcat-6.0.43webappsstudyWEB-INFclassesconfigspring-common.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: No identifier specified for entity: com.entity.User
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1391)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1132)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
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:607)
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.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4210)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4709)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:802)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1068)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:759)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:toolsapache-tomcat-6.0.43webappsstudyWEB-INFclassesconfigspring-common.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: No identifier specified for entity: com.entity.User
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1486)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
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.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:323)
... 39 more

解决方案

额,你连sessionFactory的bean都没写就引用了

解决方案二:

spring+hibernate配置文件有问题,自己在慢慢看看

解决方案三:

在spring-beans.xml配置文件中查看有没有配置userDao 的属性引用sessionFactory

<bean id="userDao" class="具体的类名">
 <property name="sessionFactory" ref="sessionFactory"/>
</bean>

解决方案四:

解决方案五:

额,你连sessionFactory的bean都没写就引用了

时间: 2024-10-02 22:22:05

entity-SSH框架问题,怎么一直报这个错的相关文章

tomcat-搭建ssh框架和comcat服务器报错求解

问题描述 搭建ssh框架和comcat服务器报错求解 Unable to load configuration. - bean - jar:file:/D:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp2/wtpwebapps/ssh/WEB-INF/lib/struts2-spring-plugin-2.1.8.1.jar!/struts-plugin.xml:29:132 at com.opensymphony.xw

ssh框架,最近总是报no session,求大神指点

问题描述 最近总是报nosession的错误,我是用了延迟加载,也在service层用了@Transactional.在网上找了一些方法,也看了各种博客,都是你抄我的我抄你的,基本就那几个方法1.lazy=false2.opensessioninview3.fetch="join"我实在不想用非延迟加载,用opensessioninview要改好多代码,也不行用.第三种不好使,所以请大家看看有什么好的办法 解决方案 解决方案二:都没人知道?????解决方案三:异常堆栈贴出来啊解决方案四

SSH框架整合 tomcat启动报错的异常

问题描述 严重:Exceptionsendingcontextinitializedeventtolistenerinstanceofclassorg.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanDefinitionStoreException:Failedtoloadbeanclass:com.accp.action.InformationsAction;neste

ssh框架登录报404求大神解答!!!

问题描述 ssh框架登录报404求大神解答!!! 我的源码: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > context

ssh框架-SSH框架整合的注册登陆例子,hql老是报错。注册可以运行,求大侠解救

问题描述 SSH框架整合的注册登陆例子,hql老是报错.注册可以运行,求大侠解救 这个是登陆源码 public boolean loginObject(User user) throws HibernateException{ System.out.println("6666666666666"); //String hql=("from User u where?u.username=? and u.password=?",user.getUsername(),u

SSH框架下调用sesion.delete()提交后运行,运行没有报错但数据库没有删除数据

问题描述 SSH框架下调用sesion.delete()提交后运行,运行没有报错但数据库没有删除数据 public boolean deleteUser(User u) { Session session = sessionFactory.getCurrentSession();// 获得session session.beginTransaction();// 开启事物 try { session.delete(u); session.getTransaction().commit(); }

过滤器怎么调用action-自定义的过滤器怎么调用ssh框架下的action业务层

问题描述 自定义的过滤器怎么调用ssh框架下的action业务层 我自定义的过滤器怎么调用javaWeb三大框架下的action业务层,我想讲我过滤器得到的用户ip等信息写入数据库 解决方案 首先,过滤器是请求到达Action之前被调用的,而且对所有的符合url-pattern的请求都会调用. 其次,没必要在过滤器中调用Action的业务,因为如果过滤操作执行完成后,最后action是会被执行的. 最后,你希望过滤得到用户的ip等信息,但是是否所有的请求都有ip信息呢?还是只有特定的action

ssh-使用SSH框架,hql查询时候语句有问题,怎么修改????

问题描述 使用SSH框架,hql查询时候语句有问题,怎么修改???? org.springframework.orm.hibernate3.HibernateQueryException: Path expected for join! [select a.title,a.docSize,a.createTime,b.value,c.value from com.aodong.juice.wendang.entity.JuiceDocument as a left join JuiceCombo

路径-SSH框架 论MyEclipse10 下ContextLoaderListener 出现的问题

问题描述 SSH框架 论MyEclipse10 下ContextLoaderListener 出现的问题 论SSH框架搭建完成后运行出现ContextLoaderListener的问题 错误提示: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.bea