关于整合ssh时候的一个错误。

Secret 发布于 2012/09/21 13:36
阅读 351
收藏 0
2012-9-21 13:37:23 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\bin;C:\apache-tomcat-6.0.18\bin
2012-9-21 13:37:23 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8081
2012-9-21 13:37:23 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 495 ms
2012-9-21 13:37:23 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2012-9-21 13:37:23 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.18
2012-9-21 13:37:24 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2012-9-21 13:37:24 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2012-9-21 13:37:25 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
2012-9-21 13:37:26 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 'userDaoImpl' defined in file [C:\apache-tomcat-6.0.18\webapps\struts_spring_hibernate\WEB-INF\classes\com\test\dao\impl\UserDaoImpl.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1403)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)
 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:871)
 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
 at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:272)
 at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:196)
 at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
 at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
 at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
 at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:516)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
 at org.springframework.orm.hibernate3.support.HibernateDaoSupport.checkDaoConfig(HibernateDaoSupport.java:118)
 at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1400)
 ... 36 more
2012-9-21 13:37:26 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2012-9-21 13:37:26 org.apache.catalina.core.StandardContext start
严重: Context [/struts_spring_hibernate] startup failed due to previous errors
2012-9-21 13:37:26 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
2012-9-21 13:37:26 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8081
2012-9-21 13:37:26 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2012-9-21 13:37:26 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/32  config=null
2012-9-21 13:37:26 org.apache.catalina.startup.Catalina start
信息: Server startup in 2771 ms
----------------------------------------------这个是哪里出错了?------------------------------------------------------
加载中
0
nicylc
nicylc

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDaoImpl' defined in file [C:\apache-tomcat-6.0.18\webapps\struts_spring_hibernate\WEB-INF\classes\com\test\dao\impl\UserDaoImpl.class]:

spring不能创建bean对象

0
sxgkwei
sxgkwei

Error creating bean with name 'userDaoImpl' defined in file

 

userDaoImpl需要注入sessionFactory或者hibernateTemplate

sxgkwei
sxgkwei
回复 @Secret : 按照我的理解,hibernate和spring结合的地方,好像必须用XML配置的,注解做不到的说。
Secret
Secret
这个我注意到了。。。好像我都试过去配置文件注入,和使用注解都没解决。
0
Secret
Secret

引用来自“sxgkwei”的答案

Error creating bean with name 'userDaoImpl' defined in file

 

userDaoImpl需要注入sessionFactory或者hibernateTemplate

哦,我试一试
返回顶部
顶部