English 中文(简体)
抛射电离线后天线的失败
原标题:Injection of autowired dependencies failed(spring+hibernate+gwt)

每个人! I m试图用春+gwt + hibernate开发一个简单的仪器。 我在春天工作,但当我执行时,我发现这一错误。

 00:00:00.018 [WARN] Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name  telekanalDAO : Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: javax.persistence.EntityManagerFactory com.karq.saatekava.server.dao.TelekanalDAO.entityManagerFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name  entityManagerFactory  defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: MyPersistenceUnit] Unable to configure EntityManagerFactory:
javax.validation.ValidationException: Unable to find a default provider     at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)  at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)    at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:342)   at org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyDDL(TypeSafeActivator.java:106)  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:616)     at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:118)  at org.hibernate.cfg.Configuration.applyBeanValidationConstraintsOnDDL(Configuration.java:1674)     at org.hibernate.cfg.Configuration.applyConstraintsToDDL(Configuration.java:1624)   at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1415)   at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1345)   at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1477)   at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:193)    at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1096)   at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:278)    at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:362)    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56)  at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)    at org.springframework.orm.jpa.LocalEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalEntityManagerFactoryBean.java:92)    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)   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)   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)  at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)     at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:474)    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:282)   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)  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)   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)  at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)   at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)  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.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:543)   at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)     at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)     at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)   at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:461)     at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)     at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)    at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)  at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)     at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)    at org.mortbay.jetty.Server.doStart(Server.java:222)    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)     at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:565)   at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:494)     at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1058)    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:800)     at com.google.gwt.dev.DevMode.main(DevMode.java:304)

接着是:http://www.javacodegeeks.com/201005/gwt-2-children-3-jpa-2-hibernate-35.html。

我的电离层

package com.karq.saatekava.server.dao;

import javax.annotation.PostConstruct;
import javax.persistence.EntityManagerFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.karq.saatekava.shared.dto.TelekanalDTO;


@Repository("telekanalDAO")
public class TelekanalDAO extends JpaDAO<Long, TelekanalDTO> {

    @Autowired
    EntityManagerFactory entityManagerFactory;

    @PostConstruct
    public void init(){
        super.setEntityManagerFactory(entityManagerFactory);
    }

}

在这里,我的神父档案

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:task="http://www.springframework.org/schema/task"
    xsi:schemaLocation="
            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
            http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
            http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">

    <context:component-scan base-package="com.karq.saatekava"/>

    <task:annotation-driven executor="myExecutor" scheduler="myScheduler"/>

    <task:executor id="myExecutor" pool-size="5"/>

    <task:scheduler id="myScheduler" pool-size="10"/>

    <tx:annotation-driven/>

    <bean class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean" id="entityManagerFactory">
        <property name="persistenceUnitName" value="MyPersistenceUnit"/>
    </bean>

    <bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory"/>
    </bean>

</beans>

希望的人能够帮助

最佳回答

对我来说,我喜欢 http://jcp.org/en/jsr/detail?id=303"rel=“nofollow” 你在你的班子中找不到验证提供者:

javax.validation.ValidationException: Unable to find a default provider

rel=“nofollow”>Hibernate Validator to the Levelpath。

问题回答

Sounds like you are missing META-INF/persistence.xml.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签