eclipse使用的maven,以前总是出现这样的问题,但是只要清理一下项目就好了,但是今天肿么都不行,高人指点下,如何从根本上解决问题啊!报错信息: 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 ""usersAPIImpl"": Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.webapp.model.service.UsersService com.webapp.api.impl.UsersAPIImpl.usersService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ""usersServiceImpl"": Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.webapp.model.dao.UsersDao com.webapp.model.service.impl.UsersServiceImpl.usersDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ""usersDaoHibernateImpl"": Autowiring of methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.webapp.util.dao.impl.GenericHibernateDao.setSessionFactory0(org.hibernate.SessionFactory); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ""sessionFactory"" defined in URL [file:/E:/tomi/tomi/callcenter/target/classes/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Hibernate Dialect must be explicitly set at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:243) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardHost.start(StandardHost.java:785) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.startup.Embedded.start(Embedded.java:825) at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:533) at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:239) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 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:585) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.webapp.model.service.UsersService com.webapp.api.impl.UsersAPIImpl.usersService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ""usersServiceImpl"": Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.webapp.model.dao.UsersDao com.webapp.model.service.impl.UsersServiceImpl.usersDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ""usersDaoHibernateImpl"": Autowiring of methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.webapp.util.dao.impl.GenericHibernateDao.setSessionFactory0(org.hibernate.SessionFactory); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ""sessionFactory"" defined in URL [file:/E:/tomi/tomi/callcenter/target/classes/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Hibernate Dialect must be explicitly set at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:435) at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:240) ... 46 more |
|
maven这个没使用过,不过LZ,你这配置文件应该是错误了,
仔细的看下错误信息! Error creating bean with name ""usersAPIImpl"": Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.webapp.model.service.UsersService com.webapp.api.impl.UsersAPIImpl.usersService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ""usersServiceImpl"": Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.webapp.model.dao.UsersDao com.webapp.model.service.impl.UsersServiceImpl.usersDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ""usersDaoHibernateImpl"": Autowiring of methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.webapp.util.dao.impl.GenericHibernateDao.setSessionFactory0(org.hibernate.SessionFactory); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ""sessionFactory"" defined in URL [file:/E:/tomi/tomi/callcenter/target/classes/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Hibernate Dialect must be explicitly set |
|
好像是自动装配配置有问题 你看下你的spring配置和代码
|
|
很明显Spring bean配置的问题。
|
|
配置出了问题,把spring的配置代码贴出来看看。
|
|
40分 |
maven正在用,也是一大堆莫名其妙的问题,有时候clean一下就好了,有时候要重启才能解决。愁人啊
|
配置文件绝对没问题 |
|
设置也肯定没有问题 |
|
maven这个东西真是麻烦,我今天重复了N次clean操作,可惜都不能解决问题。nnd最后发现同事把数据库分离了……,maven竟然不会提示没有数据库或者链接错误,反而提示spring配置错误,无语中……不过谢谢各位帮忙,结贴给分啦! |
|
eclipse就是个垃圾,用着用着就不动了,然后只能重启,重启后类、字段什么的莫名其妙的报错。
唉,屌丝产品就这样,认了!MyEclipse或许好点。 |