Hi Christian,

I think it's just a matter of adding the entity classes to the classpath
when you run the enhancer. Something like this should work :

    <target name="enhance">
        <taskdef name="openjpac"
                 classname="org.apache.openjpa.ant.PCEnhancerTask" />
        <openjpac directory=".">
            <config propertiesFile="META-INF/persistence.xml" />
            <classpath>
                <pathelement location="bin"/>
            </classpath>
            <fileset dir="bin">
                <include name="**/tables/BasicTable.class" />
                <include name="**/tables/User.class" />
            </fileset>
        </openjpac>
    </target>


As I understand it the fileset attribute tells the enhancer which classes to
enhance, but they also need to be included on the classpath.

-Mike

On Dec 21, 2007 3:46 AM, Christian Eugster <[EMAIL PROTECTED]>
wrote:

> (Hi Mike, thank you for your help for my configuration problem!) Now I met
> the next problem. I want to enhance the entities using the task '
> org.apache.openjpa.ant.PCEnhancerTask' in eclipse. After consulting the
> web I successed writing a build file as follows:
>
> ******************************************
> <?xml version="1.0" ?>
> <project name="OpenJPA Entity Enhancer" default="enhance" basedir=".">
>  <target name="enhance">
>    <taskdef name="openjpac"
>             classname="org.apache.openjpa.ant.PCEnhancerTask"/>
>    <openjpac directory=".">
>      <config propertiesFile="META-INF/persistence.xml"/>
>      <fileset dir="bin">
>        <include name="**/tables/BasicTable.class" />
>        <include name="**/tables/User.class" />
>      </fileset>
>    </openjpac>
>  </target>
> </project>
> ******************************************
>
> My environment looks like this (omitting some further dirs and files):
>
> ******************************************
> root/
>  bin/   compiled classes
>  src/   sources
>  lib/   used libraries
>  META-INF/ containing persistence.xml, orm.xml and xsd's
>  build.xml
> ******************************************
>
> The persistence.xml, orm.xml User.java and BasicTable.java files are the
> same as the last time, I did not change anything.
>
> Now I get the following error when trying to run the ant task:
>
> ******************************************
> Buildfile: C:\Projekte\Eclipse
> 3.x\ColibriTS\ch.eugster.colibri.core\build.xml
> enhance:
>  [openjpac] java.lang.IllegalArgumentException:
> java.lang.ClassNotFoundException:
> ch.eugster.colibri.core.db.tables.BasicTable
>  [openjpac]     at serp.util.Strings.toClass(Strings.java:164)
>  [openjpac]     at serp.util.Strings.toClass(Strings.java:108)
>  [openjpac]     at org.apache.openjpa.lib.meta.ClassArgParser.parseTypes(
> ClassArgParser.java:164)
>  [openjpac]     at org.apache.openjpa.enhance.PCEnhancer.run(
> PCEnhancer.java:4328)
>  [openjpac]     at org.apache.openjpa.ant.PCEnhancerTask.executeOn(
> PCEnhancerTask.java:89)
>  [openjpac]     at org.apache.openjpa.lib.ant.AbstractTask.execute(
> AbstractTask.java:172)
>  [openjpac]     at org.apache.tools.ant.UnknownElement.execute(
> UnknownElement.java:275)
>  [openjpac]     at org.apache.tools.ant.Task.perform(Task.java:364)
>  [openjpac]     at org.apache.tools.ant.Target.execute(Target.java:341)
>  [openjpac]     at org.apache.tools.ant.Target.performTasks(Target.java
> :369)
>  [openjpac]     at org.apache.tools.ant.Project.executeSortedTargets(
> Project.java:1216)
>  [openjpac]     at org.apache.tools.ant.Project.executeTarget(Project.java
> :1185)
>  [openjpac]     at
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(
> DefaultExecutor.java:40)
>  [openjpac]     at
> org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets
> (EclipseDefaultExecutor.java:32)
>  [openjpac]     at org.apache.tools.ant.Project.executeTargets(
> Project.java:1068)
>  [openjpac]     at
> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(
> InternalAntRunner.java:423)
>  [openjpac]     at
> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(
> InternalAntRunner.java:137)
>
> BUILD FAILED
> C:\Projekte\Eclipse 3.x\ColibriTS\ch.eugster.colibri.core\build.xml:11:
> java.lang.IllegalArgumentException: java.lang.ClassNotFoundException:
> ch.eugster.colibri.core.db.tables.BasicTable
>
> Total time: 1 second
> ******************************************
>
> I searched the web finding some information trying all out but did not
> succeed. Do you have any hint? Thank you in advance!
>
> Christian
> --
> ****************************
> Christian Eugster
> Grissian Widum 14
> I-39010 Tisens
> --------------------------------------
> Handy Schweiz: 0041 79 594 85 45
> Handy Italia: 0039 333 888 77 64
> Email: [EMAIL PROTECTED]
>
>
> Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
> Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
>

Reply via email to