title: Error using Entity Enhancement with Eclipse, openJPA, Tomcat and OracleDB
body: <p>I developed a few JSF/JPA applications with Eclipse Link, Glassfish and OracleDB. My new topic ist porting an application to Tomcat with openJPA. So I am testing a little, easy application with this new technology. This is more difficult as I thought. I learned from here:</p>
  
  <p><a href="http://openjpa.apache.org/enhancement-with-eclipse.html" rel="nofollow">http://openjpa.apache.org/enhancement-with-eclipse.html</a></p>
  
  <p>that I have to enhance my Entities.  I tried with the Eclipse Plugin which in part was succesfull but had few problems. In a few posts I saw that it is recommended using the Ant method, which I am currently trying.  I made the same configuration as mentioned in the link, but I get a bad error and I don't know whats the problem:</p>
  
  <blockquote>
    <p>C:\Users\XXX\EclipseWorkspace\testJSF\enhance.xml:26:
    
    org.apache.openjpa.util.MetaDataException: MetaDataFactory could not
    be configured (conf.newMetaDataFactoryInstance() returned null). This
    might mean that no configuration properties were found. Ensure that
    you have a META-INF/persistence.xml file, that it is available in your
    classpath, or that the properties file you are using for configuration
    is available. If you are using Ant, please see the  or
     attributes of the task's nested  element.
    This can also occur if your OpenJPA distribution jars are corrupt, or
    if your security policy is overly strict.</p>
  </blockquote>
  
  <p>My enhance.xml</p>
  
  <p>
  </p>
  
  <pre><code>&lt;path id="enhance.cp"&gt;
      &lt;pathelement location="${basedir}${file.separator}${build.dir}"/&gt;
          &lt;fileset dir="${basedir}${file.separator}${openjpa.libs}"&gt;
              &lt;include name="**/*.jar"/&gt;
          &lt;/fileset&gt;
  &lt;/path&gt;
  
  &lt;property name="cp" refid="enhance.cp"/&gt;
  
  &lt;target name="openjpa.libs.check" unless="openjpa.libs"&gt;
      &lt;fail message="Please set -Dopenjpa.libs in your builder configuration!" /&gt;
  &lt;/target&gt;
  
  &lt;target name="build.dir.check" unless="build.dir"&gt;
      &lt;fail message="Please set -Dbuild.dir in your builder configuration!" /&gt;
  &lt;/target&gt;
  
  &lt;target name="enhance" depends="openjpa.libs.check, build.dir.check"&gt;
      &lt;echo message="${cp}"/&gt;
      &lt;taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask"&gt;
          &lt;classpath refid="enhance.cp"/&gt;
      &lt;/taskdef&gt;
      &lt;openjpac&gt;
          &lt;classpath refid="enhance.cp"/&gt;
      &lt;/openjpac&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p></p>
  
  <p>I don't believe that persistence.xml cannot be found, because when I use the Eclipse Plugin, I am able to extract Data from the Database. But then I get this error:</p>
  
  <blockquote>
    <p>The Entity "openJPA.Todo_" was enhanced at level "2", but the current
    level of enhancement is "1.241.207".</p>
  </blockquote>
  
  <p>I don't understand what this means. I am getting very frustraded. How can I get a working project with Eclipse, Tomcat and OpenJpa?</p>
  
  <p>Thank you in advance</p>
  
  <p>Steve</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Here I found a tutorial that says to copy the persistence.xml into the build folder:
  <a href="http://openjpa.apache.org/enhancement-with-ant.html" rel="nofollow">http://openjpa.apache.org/enhancement-with-ant.html</a>
  I copied the META-INF Folder with the persistence.xml in the build folder and now the described error is gone.</p>
  
  <p>But the enhancer doesn't find my persistent class:</p>
  
  <pre><code>enhance:
          [echo] C:\Users\XXX\EclipseWorkspace\testJSF\build;C:\Users\XXX\EclipseWorkspace\testJSF\lib\openjpa-all-2.2.0.jar
      [openjpac] 12  TODO  TRACE  [Worker-119] openjpa.Runtime - Setting the following properties from "file:/C:/Users/XXX/EclipseWorkspace/testJSF/build/META-INF/persistence.xml" into configuration: {openjpa.ConnectionPassword=XXX, openjpa.ConnectionDriverName=oracle.jdbc.driver.OracleDriver, openjpa.MetaDataFactory=jpa(Types=openJPA.Todo_), openjpa.Log=DefaultLevel=TRACE, PersistenceVersion=2.0, openjpa.ConnectionUserName=XXX, openjpa.ConnectionURL=jdbc:oracle:thin:@XX.XXX.XXX.XXX:TEST, openjpa.Id=TODO}
      [openjpac] 29  TODO  TRACE  [Worker-119] openjpa.Runtime - No cache marshaller found for id org.apache.openjpa.conf.MetaDataCacheMaintenance.
      [openjpac] 454  TODO  TRACE  [Worker-119] openjpa.MetaData - Scanning resource "META-INF/orm.xml" for persistent types.
      [openjpac] 461  TODO  TRACE  [Worker-119] openjpa.MetaData - The persistent unit root url is "null"
      [openjpac] 461  TODO  TRACE  [Worker-119] openjpa.MetaData - parsePersistentTypeNames() found [openJPA.Todo_].
      [openjpac] 461  TODO  TRACE  [Worker-119] openjpa.MetaData - Found 1 classes with metadata in 19 milliseconds.
      [openjpac] 472  TODO  INFO   [Worker-119] openjpa.Tool - Enhancer running on type "openJPA.Todo_".
      [openjpac] java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: openJPA.Todo_
  </code></pre>
  
  <p>And the search goes on!</p>