Menu

JaxenXPath exception on ant generate?

Help
2008-03-16
2013-04-25
  • Matt Stucky

    Matt Stucky - 2008-03-16

    i downloaded 2.6.6, unzipped.  from mysql cmd line, created empty database, then single table.

    adjusted sql2java.properties file to same connection info as above.

    go to do 'ant generate'... get:

    Buildfile: build.xml

    generate.check:

    generate.code:
    [sql2java] GenerationTask: /home/matt/projects/protoflorum_alpha/sql2java-2-6-6/src/config/sql2java.properties
    [sql2java] org.jdom.JDOMException: java.lang.ClassNotFoundException: org.jdom.xpath.JaxenXPath: org.jdom.xpath.Jaxen
    XPath
    ... etc...

    Checked the jar, it's in place.  the 'path' element, in fact all headers, at the top of build.xml also appear to be correct.

    it all looks good to me, near as i can tell it *should* work.

    any ideas as to what I'm doing wrong?

    thanks

    matt

     
    • rjemmons

      rjemmons - 2008-03-16

      I am not sure what is wrong, but here are the items which I think are critical from my build.xml.  It works:

          <property name="sql2java-config"    value="${config}/${database-name}.properties"/>
          <property file="${sql2java-config}"/>
          <taskdef name="sql2java"
              classname="net.sourceforge.sql2java.ant.GenerationTask"
              classpathref="libId"/>

          <path id="libId">
              <pathelement location="${build}/classes"/>
              <fileset dir="${libDir}">
                  <include name="**.jar"/>
              </fileset>
              <fileset dir="${libDir}/jdom">
                  <include name="**.jar"/>
              </fileset>
          </path>

          <!-- GENERATE THE SOURCE CODE API TO ACCESS YOUR DB -->
          <target name="generate.code" depends="generate.check" unless="doNotGenerate">
              <!-- launch generation -->
              <echo message="generate.code: lib=${libDir}"/>
              <echo message="generate.code: config=${sql2java-config}"/>
              <sql2java propertyFile="${sql2java-config}"/>
          </target>

       
    • Matt Stucky

      Matt Stucky - 2008-03-17

      at the base of the stacktrace was a mysql jdbc error..... so i fixed that, my build.xml now looks like:

          <path id="lib">
              <pathelement location="${build}/classes"/>
              <fileset dir="${lib}">
                  <include name="**.jar"/>
              </fileset>
              <fileset dir="/usr/share/java/">
                  <include name="mysql5.jar" />
              </fileset>
              <fileset dir="${lib}/jdom">
                  <include name="**.jar"/>
              </fileset>
          </path>

      ...just for simplicity sake....

      the code appears to build the bean now, but i'm still getting a JaxenXPath exception stack... dont' know why or what is missing from the final resulted output...

       
    • Matt Stucky

      Matt Stucky - 2008-03-17

      had to create a CLASSPATH environment variable with the following command:

      matt$ export CLASSPATH=/path/to/sql2java-2-6-6/lib/jdom.jar:\ /path/to/sql2java-2-6-6/lib/jdom/jaxen-core.jar:\ /path/to/sql2java-2-6-6/lib/jdom/jaxen-jdom.jar:\ /path/to/sql2java-2-6-6/lib/jdom/saxpath.jar

      then, the generate.code task works with no errors or warnings

      apparently that environment property at the top of build.xml is expecting these.

      matt

       
      • Alain Fagot Béarez

        Hi Matt,

        Did you have a CLASSPATH environment variable already set prior to fix as you did?
        In the ant documentation they wrote the following:

        The CLASSPATH environment variable

        The CLASSPATH environment variable is a source of many Ant support queries. As the round trip time for diagnosis on the Ant user mailing list can be slow, and because filing bug reports complaining about 'ant.bat' not working will be rejected by the developers as WORKSFORME "this is a configuration problem, not a bug", you can save yourself a lot of time and frustration by following some simple steps.

           1. Do not ever set CLASSPATH. Ant does not need it, it only causes confusion and breaks things.
           2. If you ignore the previous rule, do not ever, ever, put quotes in the CLASSPATH, even if there is a space in a directory. This will break Ant, and it is not needed.
           3. If you ignore the first rule, do not ever, ever, have a trailing backslash in a CLASSPATH, as it breaks Ant's ability to quote the string. Again, this is not needed for the correct operation of the CLASSPATH environment variable, even if a DOS directory is to be added to the path.
           4. You can stop Ant using the CLASSPATH environment variable by setting the -noclasspath option on the command line. This is an easy way to test for classpath-related problems.

        The usual symptom of CLASSPATH problems is that ant will not run with some error about not being able to find org.apache.tools.Ant.main, or, if you have got the quotes/backslashes wrong, some very weird Java startup error. To see if this is the case, run ant -noclasspath or unset the CLASSPATH environment variable.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.