title: BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/.../DataConfiguration.class]:
body: <p>I had a project that was working. I added nearly 2 hundred entities, now I'm getting "Error creating bean with name 'entityManagerFactory'". I didn't intentionally change anything else.</p>
  
  <p>I'm using Java-style confinguration.</p>
  
  <p>I'm getting the following:</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/cru/cloud/management/config/DataConfiguration.class]: 
              Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:975)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:752)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
      at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4749)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5175)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
      at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:581)
      at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1686)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:1225)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.access$600(EntityManagerFactoryBuilderImpl.java:119)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:853)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843)
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842)
      at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:152)
      at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:336)
      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550)
      ... 25 more
  Caused by: org.hibernate.MappingException: component property not found: id
      at org.hibernate.mapping.Component.getProperty(Component.java:293)
      at org.hibernate.cfg.AnnotationBinder.fillComponent(AnnotationBinder.java:2651)
      at org.hibernate.cfg.AnnotationBinder.fillComponent(AnnotationBinder.java:2524)
      at org.hibernate.cfg.AnnotationBinder.bindComponent(AnnotationBinder.java:2473)
      at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:2198)
      at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:963)
      at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:796)
      at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3788)
      at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3742)
      at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1410)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1844)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
      ... 33 more
  </code></pre>
  
  <p>My pom.xml is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
    &lt;artifactId&gt;spring-security-samples-hellomvc-jc&lt;/artifactId&gt;
    &lt;version&gt;3.2.5.RELEASE&lt;/version&gt;
    &lt;packaging&gt;war&lt;/packaging&gt;
    &lt;name&gt;spring-security-samples-hellomvc-jc&lt;/name&gt;
    &lt;description&gt;spring-security-samples-hellomvc-jc&lt;/description&gt;
    &lt;url&gt;http://spring.io/spring-security&lt;/url&gt;
    &lt;properties&gt;
      &lt;m2eclipse.wtp.contextRoot&gt;/&lt;/m2eclipse.wtp.contextRoot&gt;
      &lt;!-- spring.version&gt;3.2.11.RELEASE&lt;/spring.version --&gt;
      &lt;!-- spring.security.version&gt;3.2.5.RELEASE&lt;/spring.security.version --&gt;
      &lt;!-- hibernate.entity.manager.version&gt;3.6.10.Final&lt;/hibernate.entity.manager.version --&gt;
      &lt;!-- hibernate.jpa.api.version&gt;1.0.0.Final&lt;/hibernate.jpa.api.version --&gt;
      &lt;!-- spring.data.jpa.version&gt;1.3.4.RELEASE&lt;/spring.data.jpa.version --&gt;
      &lt;!-- slf4j.version&gt;1.7.5&lt;/slf4j.version --&gt;
      &lt;spring.version&gt;4.0.7.RELEASE&lt;/spring.version&gt;
      &lt;spring.security.version&gt;3.2.5.RELEASE&lt;/spring.security.version&gt;
      &lt;hibernate.entity.manager.version&gt;4.3.6.Final&lt;/hibernate.entity.manager.version&gt;
      &lt;hibernate.jpa.api.version&gt;1.0.1.Final&lt;/hibernate.jpa.api.version&gt;
      &lt;spring.data.jpa.version&gt;1.7.0.RELEASE&lt;/spring.data.jpa.version&gt;
      &lt;slf4j.version&gt;1.7.7&lt;/slf4j.version&gt;
    &lt;/properties&gt;
    &lt;organization&gt;
      &lt;name&gt;spring.io&lt;/name&gt;
      &lt;url&gt;http://spring.io/&lt;/url&gt;
    &lt;/organization&gt;
    &lt;licenses&gt;
      &lt;license&gt;
        &lt;name&gt;The Apache Software License, Version 2.0&lt;/name&gt;
        &lt;url&gt;http://www.apache.org/licenses/LICENSE-2.0.txt&lt;/url&gt;
        &lt;distribution&gt;repo&lt;/distribution&gt;
      &lt;/license&gt;
    &lt;/licenses&gt;
    &lt;developers&gt;
      &lt;developer&gt;
        &lt;id&gt;rwinch&lt;/id&gt;
        &lt;name&gt;Rob Winch&lt;/name&gt;
        &lt;email&gt;rwinch@gopivotal.com&lt;/email&gt;
      &lt;/developer&gt;
    &lt;/developers&gt;
    &lt;scm&gt;
      &lt;connection&gt;scm:git:git://github.com/spring-projects/spring-security&lt;/connection&gt;
      &lt;developerConnection&gt;scm:git:git://github.com/spring-projects/spring-security&lt;/developerConnection&gt;
      &lt;url&gt;https://github.com/spring-projects/spring-security&lt;/url&gt;
    &lt;/scm&gt;
  </code></pre>
  
  <p>My DataConfiguration contains:</p>
  
  <pre><code>    @Bean
      public LocalContainerEntityManagerFactoryBean entityManagerFactory()
      {       
              HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
              vendorAdapter.setDatabase(Database.H2);
              vendorAdapter.setGenerateDdl(true);
  
              LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
              factory.setJpaVendorAdapter(vendorAdapter);
              factory.setPackagesToScan("org.cru.cloud.management.core.repository", "org.cru.repository");
              factory.setDataSource(dataSource());
  
              return factory;
      }
  </code></pre>