Menu

Error org.jdom.Element.addContent(....

peter_za
2006-12-01
2013-04-25
  • peter_za

    peter_za - 2006-12-01

    firstly - great tool !! I see this error has appeared twice before but seems to be a problem to reproduce.  I get it as well.  Hopefully this will help:

    STACK TRACE:
    [sqlunit] Caused by: java.lang.NoSuchMethodError: org.jdom.Element.addContent(Lorg/jdom/Element;)Lorg/jdom/Element;
      [sqlunit]     at net.sourceforge.sqlunit.beans.Row.toElement(Row.java:160)
      [sqlunit]     at net.sourceforge.sqlunit.beans.ResultSetBean.toElement(ResultSetBean.java:265)
      [sqlunit]     at net.sourceforge.sqlunit.beans.DatabaseResult.toElement(DatabaseResult.java:242)
      [sqlunit]     at net.sourceforge.sqlunit.beans.DatabaseResult.toString(DatabaseResult.java:255)
      [sqlunit]     at net.sourceforge.sqlunit.Assertions.subAssertResultSetsEqual(Assertions.java:989)
      [sqlunit]     at net.sourceforge.sqlunit.Assertions.assertResultSetsEqual(Assertions.java:465)
      [sqlunit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [sqlunit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      [sqlunit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      [sqlunit]     at java.lang.reflect.Method.invoke(Method.java:585)
      [sqlunit]     at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions.java:830)
     
    ANT COMMAND:
    "C:\Program Files\Java\jdk1.5.0_09\bin\java.exe"  -classpath "C:\java_tools\apache-ant-1.6.5\lib\ant-launcher.jar" "-Dant.home=C:\java_tools\apache-ant-1.6.5" org.apache.tools.ant.launch.Launcher  -cp "C:\java_tools\sqlunit-4.9\lib\junit.jar;C:\java_tools\sqlunit-4.9\lib\log4j-1.2.8.jar;" -buildfile testsybase.xml
    Buildfile: testsybase.xml

    testsybase.xml contents:
    <!-- This is repeated for each test or
         group of tests in case of nested filesets -->
    <project name="testBasics" default="run-sybase-test" basedir="..">

      <!-- This is specified once per buildfile -->
      <target name="def">
        <taskdef name="sqlunit"
             classname="net.sourceforge.sqlunit.ant.SqlunitTask">
          <classpath>
            <pathelement location="C:/java_tools/sqlunit-4.9/lib/sqlunit-4.9.jar" />
          </classpath>
        </taskdef>
      </target>

      <target name="run-sybase-test" depends="def">
        <sqlunit testfile="test/sybase/MyTestProcTest1.xml"
            haltOnFailure="false" debug="true" />
      </target>
    </project>

    MyTestProcTest1.xml contents:
        <sqlunit>
          <connection transaction-support="off">
              <driver>net.sourceforge.jtds.jdbcx.JtdsDataSource</driver>
              <url>jdbc:jtds:sybase://-------</url>
              <user>------</user>
              <password>------</password>
          </connection>
       
          <setup>
            <sql><stmt>set chained off</stmt></sql>
          </setup>
       
          <test name="Testing all NUMERIC and DECIMAL">
            <sql>
              <stmt>
             select ltrim(rtrim(ID))
             from <table>
             where ID = 'AAAA0DD1201126717'
              </stmt>
            </sql>
            <result>
              <resultset id="1">
                <row id="1">
                  <col id="01" type="CHAR">AAAA0DD1201126717</col>
                </row>
              </resultset>
            </result>
          </test>
       
          <teardown />
       
        </sqlunit>

    This is a problem with 4.9 and 5.0.

    WORK AROUND:
    specify the jdom.jar in the classpath as the older version - sqlunit-4.9\lib\jdom.jar
    "C:\Program Files\Java\jdk1.5.0_09\bin\java.exe"  -classpath "C:\java_tools\apache-ant-1.6.5\lib\ant-launcher.jar" "-Dant.home=C:\java_tools\apache-ant-1.6.5" org.apache.tools.ant.launch.Launcher  -cp "C:\java_tools\sqlunit-4.9\lib\jdom.jar;C:\java_tools\sqlunit-5.0\lib\junit.jar;C:\java_tools\sqlunit-5.0\lib\log4j-1.2.13.jar;" -buildfile testsybase.xml

    Hope that helps

    Peter

     
    • Jeff Hedlund

      Jeff Hedlund - 2006-12-07

      FYI:

      I had the same problem and I was able to get around it by recompiling with my version of Java (1.4).  Using 4.9's jar files did not work for me.

      Jeff

       

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.