Re: Ant cgen task not working after following tutorial

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon May 25 2009 - 05:11:08 EDT

  • Next message: Joseph Wamicha: "Re: Ant cgen task not working after following tutorial"

    The stack shows that ClassGenerator class is present, while
    ClassGeneratorResourceLoader is not. Both are coming from the same
    JAR. Very strange... Could you possibly try the same thing with
    Cayenne 3.0M5?

    Also you can debug it with "ant -v" to see what the "full.classpath"
    is set to (maybe there's a conflicting Velocity installation or
    something).

    Andrus

    On May 25, 2009, at 11:55 AM, Joseph Wamicha wrote:

    > Hi Andrus,
    >
    > Thanks for your response. The version is: cayenne-2.0.4
    >
    > Andrus Adamchik wrote:
    >> Hi Joseph,
    >>
    >> which version of Cayenne is that?
    >>
    >> Andrus
    >>
    >>
    >> On May 25, 2009, at 11:21 AM, Joseph Wamicha wrote:
    >>
    >>> Hi,
    >>>
    >>> I'm currently experimenting with cayenne; it's looking good.
    >>>
    >>> I have however run into problems while running the ant cgen task.
    >>> I'm not sure what's going wrong with ant cgen. I would be grateful
    >>> for any help on this. Please see my ant task below:
    >>>
    >>> <path id="full.classpath">
    >>> <fileset dir="lib" />
    >>> </path>
    >>> <!-- Custom apache cayenne ant tasks...-->
    >>> <typedef resource="org/apache/cayenne/tools/antlib.xml">
    >>> <classpath refid="full.classpath"/>
    >>> </typedef>
    >>> <target name="classgen">
    >>> <cgen map="src/PersistenceMap.map.xml" destDir="test"
    >>> usepkgpath="true" superpkg="com.plugin.persistence" />
    >>> </target>
    >>>
    >>> and inside my lib directory I have the cayenne.jar file
    >>>
    >>> When I now run ant classgen, I get the following error:
    >>>
    >>> sysadmi..strodon$ ant classgen
    >>> Buildfile: build.xml
    >>>
    >>> classgen:
    >>> [cgen] Error generating classes: Problem initializing template
    >>> loader: org.apache.cayenne.gen.ClassGeneratorResourceLoader
    >>> [cgen] Error is: java.lang.ClassNotFoundException:
    >>> org.apache.cayenne.gen.ClassGeneratorResourceLoader
    >>> [cgen] at java.net.URLClassLoader$1.run(URLClassLoader.java:
    >>> 200)
    >>> [cgen] at java.security.AccessController.doPrivileged(Native
    >>> Method)
    >>> [cgen] at
    >>> java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    >>> [cgen] at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    >>> [cgen] at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    >>> [cgen] at
    >>> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    >>> [cgen] at java.lang.Class.forName0(Native Method)
    >>> [cgen] at java.lang.Class.forName(Class.java:169)
    >>> [cgen] at
    >>> org
    >>> .apache
    >>> .velocity
    >>> .runtime
    >>> .resource
    >>> .loader.ResourceLoaderFactory.getLoader(ResourceLoaderFactory.java:
    >>> 41)
    >>> [cgen] at
    >>> org
    >>> .apache
    >>> .velocity
    >>> .runtime
    >>> .resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:
    >>> 142)
    >>> [cgen] at
    >>> org
    >>> .apache
    >>> .velocity
    >>> .runtime
    >>> .RuntimeInstance.initializeResourceManager(RuntimeInstance.java:522)
    >>> [cgen] at
    >>> org
    >>> .apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:
    >>> 227)
    >>> [cgen] at
    >>> org
    >>> .apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:
    >>> 461)
    >>> [cgen] at
    >>> org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:106)
    >>> [cgen] at
    >>> org
    >>> .apache
    >>> .cayenne
    >>> .gen.ClassGenerator.initializeClassTemplate(ClassGenerator.java:149)
    >>> [cgen] at
    >>> org.apache.cayenne.gen.ClassGenerator.<init>(ClassGenerator.java:94)
    >>> [cgen] at
    >>> org
    >>> .apache
    >>> .cayenne
    >>> .gen
    >>> .MapClassGenerator.generateClassPairs_1_1(MapClassGenerator.java:
    >>> 222)
    >>> [cgen] at
    >>> org
    >>> .apache
    >>> .cayenne
    >>> .gen.MapClassGenerator.generateClassPairs(MapClassGenerator.java:
    >>> 199)
    >>> [cgen] at
    >>> org
    >>> .apache
    >>> .cayenne
    >>> .gen.DefaultClassGenerator.execute(DefaultClassGenerator.java:98)
    >>> [cgen] at
    >>> org
    >>> .apache
    >>> .cayenne.tools.CayenneGenerator.processMap(CayenneGenerator.java:
    >>> 144)
    >>> [cgen] at
    >>> org
    >>> .apache
    >>> .cayenne.tools.CayenneGenerator.execute(CayenneGenerator.java:80)
    >>> [cgen] at
    >>> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    >>> [cgen] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
    >>> Method)
    >>> [cgen] at
    >>> sun
    >>> .reflect
    >>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    >>> [cgen] at
    >>> sun
    >>> .reflect
    >>> .DelegatingMethodAccessorImpl
    >>> .invoke(DelegatingMethodAccessorImpl.java:25)
    >>> [cgen] at java.lang.reflect.Method.invoke(Method.java:597)
    >>> [cgen] at
    >>> org
    >>> .apache
    >>> .tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    >>> [cgen] at org.apache.tools.ant.Task.perform(Task.java:348)
    >>> [cgen] at org.apache.tools.ant.Target.execute(Target.java:357)
    >>> [cgen] at
    >>> org.apache.tools.ant.Target.performTasks(Target.java:385)
    >>> [cgen] at
    >>> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
    >>> [cgen] at
    >>> org.apache.tools.ant.Project.executeTarget(Project.java:1306)
    >>> [cgen] at
    >>> org
    >>> .apache
    >>> .tools
    >>> .ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    >>> [cgen] at
    >>> org.apache.tools.ant.Project.executeTargets(Project.java:1189)
    >>> [cgen] at org.apache.tools.ant.Main.runBuild(Main.java:758)
    >>> [cgen] at org.apache.tools.ant.Main.startAnt(Main.java:217)
    >>> [cgen] at
    >>> org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
    >>> [cgen] at
    >>> org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
    >>>
    >>> BUILD FAILED
    >>>
    >>> What could be going wrong?
    >>>
    >>> Thanks,
    >>> Joseph.
    >>>
    >>
    >
    >



    This archive was generated by hypermail 2.0.0 : Mon May 25 2009 - 05:11:43 EDT