title: No persistence units parsed from {classpath*:META-INF/persistence.xml}
body: <p>Using Spring Core 3.0.5, Hibernate 3.6.0.
  The title of this question is the message of a java.lang.IllegalStateException raised on starting a Tomcat webserver (6.0.29) with an application I am maintaining.</p>
  
  <p>applicationContext.xml says:</p>
  
  <pre><code>&lt;bean id="emf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" scope="singleton"&gt;
     &lt;property name="jpaVendorAdapter"&gt;
       &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" /&gt;
    &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>persistence.xml is in the META-INF directory of a jar file the project includes. Expedissimo.web.war has a WEB-INF/classes folder with said .jar.</p>
  
  <p>The complete exception traceback on starting the server is:</p>
  
  <blockquote>
    <p>GRAVE: Exception lors de l'envoi de l'évènement contexte initialisé
    (context initialized) à l'instance de classe d'écoute (listener)
    org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name 'emf' defined in ServletContext resource
    [/WEB-INF/applicationContext.xml]: Invocation of init method failed;
    nested exception is java.lang.IllegalStateException: No persistence
    units parsed from {classpath*:META-INF/persistence.xml}   at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
      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.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
      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.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
      at
    org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
      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:546)
      at
    org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
      at
    org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
      at
    org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
      at
    org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
      at
    org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at
    org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
      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:445)
      at
    org.apache.catalina.core.StandardService.start(StandardService.java:519)
      at
    org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:581)    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:289)   at
    org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) Caused
    by: java.lang.IllegalStateException: No persistence units parsed from
    {classpath*:META-INF/persistence.xml}     at
    org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.obtainDefaultPersistenceUnitInfo(DefaultPersistenceUnitManager.java:373)
      at
    org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.determinePersistenceUnitInfo(LocalContainerEntityManagerFactoryBean.java:247)
      at
    org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:196)
      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)</p>
  </blockquote>
  
  <pre><code>... 36 more
  </code></pre>
  
  <p>persistence.xml says:</p>
  
  <pre><code>&lt;persistence xmlns="http://java.sun.com/xml/ns/persistence"     xmlns:xsi="http://www.w3.org    /2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"&gt;
  &lt;persistence-unit name="serv2010pool" transaction-type="RESOURCE_LOCAL"&gt;
  &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt; 
      &lt;properties&gt;
          &lt;property name="hibernate.show_sql" value="false" /&gt; 
          &lt;property name="hibernate.format_sql" value="true" /&gt; 
          &lt;property name="use_sql_comments" value="true" /&gt; 
          &lt;property name="hibernate.autocommit" value="false" /&gt; 
          &lt;property name="javax.persistence.jdbc.driver"     value="oracle.jdbc.OracleDriver"/&gt;
          &lt;property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/&gt;
          &lt;property name="hibernate.connection.insee.poolName" value="serv2010pool" /&gt;
          &lt;property name="hibernate.connection.provider_class" value=
              "fr.insee.config.hibernate.InseeConnectionProvider"/&gt;           
      &lt;/properties&gt;
  &lt;/persistence-unit&gt;
  </code></pre>
  
  <p></p>
  
  <p>The same persistence unit descriptor, when used outside Spring in the batch sibling project, is found and parsed correctly from</p>
  
  <pre><code>    emf = Persistence.createEntityManagerFactory("serv2010pool");
  </code></pre>
  
  <p>The batch project, just like the web project, includes Serv2010-1.0.jar, which has META-INF/persistence.xml . All annotated classes are in this common jar.</p>
  
  <p>Deploying inside Eclipse v3.6 raises the exception. The WEB-INF/classes/ folder in the .war doesn't have the persistence.xml file. Adding it manually and restarting the server doesn't help.</p>
  
  <p>Any idea? I'm running out of tricks here, thanks for providing any.
  CChris</p>