maven,hibernate,spring问题 [英] maven, hibernate, spring problems
问题描述
我有一个项目的问题,我想用maven运行,在我使用spring和hibernate的时候,顺便说一句,我是这些技术新手的新手。如果有人可以帮我解决这个问题,那么我会举一个例子说明哪个出租车可以轻松运行,但是你
这是我的例外:
org.springframework.beans.factory.BeanCreationException:创建名为'contactController'的bean时出错:注入自动装配的依赖失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:无法自动装入字段:private net.viralpatel.contact.service.ContactService net.viralpatel.contact.controller.ContactController.contactService;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'contactServiceImpl'的bean时出错:注入自动装配依赖失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:无法自动装入字段:private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'contactDAOImpl'的bean时出错:注入自动装配依赖项失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:无法自动装入字段:private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory;嵌套异常是java.lang.NoClassDefFoundError:Lorg / hibernate / cache / CacheProvider;
在org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1064)在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222 )
造成的原因:
:org.springframework.beans.factory.BeanCreationException:可以不是autowire字段:private net.viralpatel.contact.service.ContactService net.viralpatel.contact.controller.ContactController.contactService;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'contactServiceImpl'的bean时出错:注入自动装配依赖失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:无法自动装入字段:private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'contactDAOImpl'的bean时出错:注入自动装配依赖项失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:无法自动装入字段:private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory;嵌套异常是java.lang.NoClassDefFoundError:Lorg / hibernate / cache / CacheProvider;
由org引发。 springframework.beans.factory.BeanCreationException:创建名为'contactServiceImpl'的bean时出错:注入自动装配依赖失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:无法自动装入字段:private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'contactDAOImpl'的bean时出错:注入自动装配依赖项失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:无法自动装入字段:private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory;嵌套异常是java.lang.NoClassDefFoundError:Lorg / hibernate / cache / CacheProvider;
....
谢谢帮助
java.lang.NoClassDefFoundError:Lorg / hibernate / cache / CacheProvider;
好像您缺少 hibernate-core.jar
在您的项目。将它添加到你的CLASSPATH。 挑选与其他堆栈兼容的版本。
i have a problem with a project that i want to run with maven, in with i use spring and hibernate, i'm new to these technokogies by the way. just if someone can hepl me solve the problem, on post me an example which cab be runned easly , thnas you this is my exception :
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.service.ContactService net.viralpatel.contact.controller.ContactController.contactService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; nested exception is java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider;
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1064)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
it's caused by :
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.service.ContactService net.viralpatel.contact.controller.ContactController.contactService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; nested exception is java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider;
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; nested exception is java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider;
....
thank you for help
java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider;
Seems like you are missing hibernate-core.jar
in your project. Add it to your CLASSPATH. Pick version that is compatible with the rest of your stack.
这篇关于maven,hibernate,spring问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!