title: I get a PersistenceException and I cannot understand why
body: <p>I am running a web service using EclipseLink and it works good. But sometimes I get an exception saying "Unable to predeploy PersistenceUnit". I i don´t have a clue why I am getting this. Everything else seems to work and the exception doesn´t seem to disturb the application, it is just beeing catched.</p>
  
  <pre><code>Exception Description: Unable to predeploy PersistenceUnit [MyLibPU] in invalid state [Undeployed]
  javax.persistence.PersistenceException: Exception [EclipseLink-28017] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.EntityManagerSetupException
  Exception Description: Unable to predeploy PersistenceUnit [MyLibPU] in invalid state [Undeployed]
      at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:956)
      at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:121)
      at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
      at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
  ....
  ....
  Caused by: Exception [EclipseLink-28017] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.EntityManagerSetupException
  Exception Description: Unable to predeploy PersistenceUnit [MyLibPU] in invalid state [Undeployed]
      at org.eclipse.persistence.exceptions.EntityManagerSetupException.cannotPredeploy(EntityManagerSetupException.java:202)
      ... 30 more
  </code></pre>
  
  <p>In the exception I can find a trace to a line in a method: </p>
  
  <pre><code>EntityManagerFactory emf = Persistence.createEntityManagerFactory("MyLibPU");
  </code></pre>
  
  <p>Why am I getting this?</p>
  
  <p><strong>EDIT</strong><br />
  This is the output I get when eclipselink logging is set to <code>FINEST</code>.</p>
  
  <pre><code>[EL Finest]: 2012-04-23 15:19:06.025--ServerSession(2134178364)--Thread(Thread[Finalizer,8,system])--End undeploying Persistence Unit MyLibPU; session file:/home/Rox/MyLib/trunk/MyLib/build/classes/_MyLibPU; state Undeployed; factoryCount 0
  [EL Finest]: 2012-04-23 15:19:06.025--ServerSession(2113649746)--Thread(Thread[Finalizer,8,system])--Begin undeploying Persistence Unit MyLibPU; session file:/home/Rox/MyLib/trunk/MyLib/src/_MyLibPU; state Deployed; factoryCount 3
  [EL Finest]: 2012-04-23 15:19:06.025--ServerSession(2113649746)--Thread(Thread[Finalizer,8,system])--End undeploying Persistence Unit MyLibPU; session file:/home/Rox/MyLib/trunk/MyLib/src/_MyLibPU; state Deployed; factoryCount 2
  Apr 23, 2012 3:19:06 PM com.sun.xml.internal.ws.server.sei.EndpointMethodHandler invoke
  SEVERE: Exception [EclipseLink-28017] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.EntityManagerSetupException
  Exception Description: Unable to predeploy PersistenceUnit [MyLibPU] in invalid state [Undeployed]
  javax.persistence.PersistenceException: Exception [EclipseLink-28017] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.EntityManagerSetupException
  Exception Description: Unable to predeploy PersistenceUnit [MyLibPU] in invalid state [Undeployed]
      at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:956)
      at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:121)
      at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
      at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
      at com.mylib.MyImplementation.getPersons(MyImplementation.java:171)
      at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at com.sun.xml.internal.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:235)
      at com.sun.xml.internal.ws.server.InvokerTube$2.invoke(InvokerTube.java:135)
      at com.sun.xml.internal.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:246)
      at com.sun.xml.internal.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:85)
      at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:626)
      at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:585)
      at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570)
      at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467)
      at com.sun.xml.internal.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:299)
      at com.sun.xml.internal.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:593)
      at com.sun.xml.internal.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
      at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handleExchange(WSHttpHandler.java:95)
      at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handle(WSHttpHandler.java:80)
      at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
      at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)
      at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:80)
      at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:668)
      at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
      at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:640)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:722)
  Caused by: Exception [EclipseLink-28017] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.EntityManagerSetupException
  Exception Description: Unable to predeploy PersistenceUnit [MyLibPU] in invalid state [Undeployed]
      at org.eclipse.persistence.exceptions.EntityManagerSetupException.cannotPredeploy(EntityManagerSetupException.java:202)
      ... 30 more
  
  [EL Finer]: 2012-04-23 15:20:06.003--Thread(Thread[pool-1-thread-61,5,main])--fixUNC: before fixing: url = file:/home/Rox/MyLib/build/classes/, authority = , file = /home/Rox/MyLib/build/classes/ (There is no English translation for this message.)
  [EL Finer]: 2012-04-23 15:20:06.012--Thread(Thread[pool-1-thread-61,5,main])--fixUNC: after fixing: url = file:/home.....
  </code></pre>
  
  <p><strong>EDIT 2</strong><br />
  My persistence.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="2.0" 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"&gt;
    &lt;persistence-unit name="MyLibPU" transaction-type="RESOURCE_LOCAL"&gt;
      &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt;
      &lt;class&gt;com.mylib.Person&lt;/class&gt;
      &lt;class&gt;com.mylib.Group&lt;/class&gt;
      &lt;properties&gt;
        &lt;property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/MY_DB"/&gt;
        &lt;property name="javax.persistence.jdbc.password" value="MyPassword"/&gt;
        &lt;property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/&gt;
        &lt;property name="javax.persistence.jdbc.user" value="root"/&gt;
        &lt;property name="eclipselink.logging.level" value="FINEST"/&gt;;
        &lt;property name="eclipselink.logging.level.sql" value="FINEST"/&gt;;
        &lt;property name="eclipselink.logging.parameters" value="true"/&gt;;
      &lt;/properties&gt;
    &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>