> -----Original Message-----
> From: KARR, DAVID (ATTCINW)
> Sent: Thursday, December 10, 2009 11:57 AM
> To: [email protected]
> Subject: CNF exception for domain class when using PCEnhancerTask
> 
> I'm trying to get a project using OpenJPA 1.2.1 moving.  I'm having
> trouble trying to do enhancement at build time.  I'm having other
> problems with enhancement at load time, so I would think I could get
> more information if I do this at build time.
> 
> In the following code excerpts, some things are replaced with "<<>>"
> wrappers, for paranoia's sake.
> 
> The following is the relevant part of my build.xml:
> 
> ----------
>       <path id="enhance.classpath">
>               <pathelement location="${openjpa.jar}"/>
>               <pathelement location="${jpa.jar}"/>
>         <pathelement location="${jta.jar}"/>
>               <pathelement location="${commons-lang.jar}"/>
>               <pathelement location="${serp.jar}"/>
>               <pathelement location="src"/>
>           <pathelement location="build/classes"/>
>       </path>
> 
>       <taskdef classpathref="enhance.classpath" name="openjpac"
> classname="org.apache.openjpa.ant.PCEnhancerTask"/>
> 
>       <target name="enhance.classes">
>               <openjpac directory="build/enhancedClasses">
>                       <fileset dir="build/classes">
>                           <include name="**/domain/*.class"/>
>                       </fileset>
>               </openjpac>
>       </target>
> ---------------
> 
> Following is my "META-INF/persistence.xml" file:
> ----------------
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.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_1_0.xsd";>
>     <persistence-unit name="<<mypersistenceunit>>"
> transaction-type="JTA">
> 
>
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provi
> d
> er>
>         <jta-data-source>jdbc/catalog</jta-data-source>
>         <mapping-file><<filepath>>/domain/orm.xml</mapping-file>
>         <properties>
>             <property name="openjpa.Log" value="DefaultLevel=TRACE"/>
>         </properties>
>     </persistence-unit>
> </persistence>
> ----------------
> 
> Following is my "domain/orm.xml" file:
> ----------------
> <?xml version="1.0" encoding="UTF-8"?>
> <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm";
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
> http://java.sun.com/xml/ns/persistence/orm_1_0.xsd";
>     version="1.0">
>     <description><<application name>></description>
>     <package><<packagepath>>.domain</package>
>     <entity name="Catalog" class="<<packagepath>>.domain.Catalog">
>     </entity>
> </entity-mappings>
> ----------------
> 
> The following is my build output:
> ----------------
> 16  dynamicContent  TRACE  [main] openjpa.Runtime - Setting the
> following properties from
> "file:/c:/Documents%20and%20Settings/<<pathtoproject>>/src/META-
> INF/pers
> istence.xml" into configuration: {openjpa.Log=DefaultLevel=TRACE,
> openjpa.MetaDataFactory=jpa(Resources=<<packagepath>>/domain/orm.xml),
>
javax.persistence.provider=org.apache.openjpa.persistence.PersistencePr
> o
> viderImpl, openjpa.ConnectionFactoryMode=managed,
> openjpa.TransactionMode=managed,
> openjpa.ConnectionFactoryName=jdbc/catalog, openjpa.Id=dynamicContent}
> 32  dynamicContent  TRACE  [main] openjpa.Runtime - No cache
marshaller
> found for id org.apache.openjpa.conf.MetaDataCacheMaintenance.
> 188  dynamicContent  TRACE  [main] openjpa.Runtime - No cache
> marshaller
> found for id org.apache.openjpa.conf.MetaDataCacheMaintenance.
> java.lang.IllegalArgumentException: java.lang.ClassNotFoundException:
> <<packagepath>>.domain.Catalog
> ---------------
> 
> The "src" classpath entry is where it finds my
> "META-INF/persistence.xml" (which is shown in the build output).
> 
> The "build/classes" classpath entry contains (at least)
> "<<packagepath>>.domain.Catalog.class".
> 
> I don't understand why it's failing to find the domain class.
> 
> Another problem I'm having is that I don't even get this far when I
run
> the Ant task from Eclipse.  Instead, I just get the following:
> 
> ---------------
> enhance.classes:
> 
> BUILD FAILED
> <<filepath>>\build.xml:50: java.lang.NoClassDefFoundError:
> org/apache/openjpa/lib/util/ParseException :
> org/apache/commons/lang/exception/NestableRuntimeException
> ---------------
> 
> Line 50 is the "openjpac" call.

This morning I tried changing the task to search for the Java source
files, instead of the class files.  It now appears to work perfectly
fine from the command line, although I haven't verified any of the
results yet.  It's producing Java class files in my destination
directory.

I'm having trouble running the same task from Eclipse, but that appears
to be some odd problem with the Ant classpath in Eclpse.

Reply via email to