Menu

Newbie Assistance Please

Anonymous
2004-01-23
2004-01-28
  • Anonymous

    Anonymous - 2004-01-23

    Hi there - I'm trying out SQLUnit for the first time using Ant in Oracle JDeveloper 9i, with the following examples, and am just not able to get past the Exception as shown in the debug output below. The SQL is accurate, against a very simple MS Access db across the jdbc/odbc bridge.

    Any suggestions would be most welcome.

    DR

    ----------------------
    build.xml:
    ----------------------

    <project name="test" basedir="." default="all">

      <property name="sqlunit.home" value="sqlunit"/>

      <taskdef name="sqlunit" classname="net.sourceforge.antsqlunittask.SqlunitTask">
        <classpath>
          <pathelement path="${sqlunit.home}/lib"/>
          <fileset dir="${sqlunit.home}" includes="lib/*.jar"/>
        </classpath>
      </taskdef>

    <target name="all">
      <sqlunit testfile="sqlunitTest.xml" haltOnFailure="true" debug="true" />
    </target>

    </project>

    ----------------------
    sqlunit.Test.xml:
    ----------------------

    <?xml version="1.0"?>
    <!DOCTYPE sqlunit SYSTEM "sqlunit/docs/sqlunit.dtd">

    <sqlunit>
      <connection>
        <driver>sun.jdbc.odbc.JdbcOdbcDriver</driver>
        <url>jdbc:odbc:AUSOUG</url>
        <user/>
        <password/>
      </connection>
      <test name="Looking up MemberNumbers">
        <sql>
          <stmt>select MemberNumber from AUSOUG where MemberNumber='AU6055X'</stmt>
        </sql>
        <result>
          <resultset id="1">
            <row id="1">
              <col id="2" type="VARCHAR">AU6055X</col>
            </row>
          </resultset>
        </result>
      </test>
    </sqlunit>

    --------------
    Debug Output
    --------------

    all:
      [sqlunit] void java.lang.Exception.<init>(java.lang.String, java.lang.Throwable)
      [sqlunit] java.lang.NoSuchMethodError: void java.lang.Exception.<init>(java.lang.String, java.lang.Throwable)
      [sqlunit]     void net.sourceforge.sqlunit.SQLUnitException.<init>(java.lang.String, java.lang.String[], java.lang.Exception)
      [sqlunit]         SQLUnitException.java:73
      [sqlunit]     net.sourceforge.sqlunit.SQLUnitResult net.sourceforge.sqlunit.SQLUnit.processDoc()
      [sqlunit]         SQLUnit.java:256
      [sqlunit]     void net.sourceforge.sqlunit.SQLUnit.testWrapper()
      [sqlunit]         SQLUnit.java:143
      [sqlunit]     void net.sourceforge.sqlunit.SQLUnit.runTest()
      [sqlunit]         SQLUnit.java:132
      [sqlunit]     void net.sourceforge.antsqlunittask.SqlunitTask.execute()
      [sqlunit]         SqlunitTask.java:101
      [sqlunit]     void org.apache.tools.ant.Task.perform()
      [sqlunit]         Task.java:317
      [sqlunit]     void org.apache.tools.ant.Target.execute()
      [sqlunit]         Target.java:309
      [sqlunit]     void org.apache.tools.ant.Target.performTasks()
      [sqlunit]         Target.java:334
      [sqlunit]     void org.apache.tools.ant.Project.executeTarget(java.lang.String)
      [sqlunit]         Project.java:1306
      [sqlunit]     void org.apache.tools.ant.Project.executeTargets(java.util.Vector)
      [sqlunit]         Project.java:1250
      [sqlunit]     void org.apache.tools.ant.Main.runBuild(java.lang.ClassLoader)
      [sqlunit]         Main.java:610
      [sqlunit]     void org.apache.tools.ant.Main.start(java.lang.String[], java.util.Properties, java.lang.ClassLoader)
      [sqlunit]         Main.java:196
      [sqlunit]     void org.apache.tools.ant.Main.main(java.lang.String[])
      [sqlunit]         Main.java:235
      [sqlunit] void java.lang.Exception.<init>(java.lang.String, java.lang.Throwable)

    BUILD FAILED

     
    • Sujit Pal

      Sujit Pal - 2004-01-23

      Hi Dennis,

      You are probably using the 1.3 JDK which did not allow chained exceptions. So when SQLUnitException is getting instantiated, its calling super() with a Throwable containing the exception which caused the SQLUnitException to be thrown. The 1.3 JDK probably comes bundled with Oracle JDeveloper, you will probably get some indication of why the error is happening if you install JDK 1.4 and set your JAVA_HOME to point to it, then run the ant script from the command line.

      Looking at the code as to why an exception may have been thrown in the first place, it points me to a generic xml error, which may be caused by an error in the test document. I eyeballed the XML you supplied, about the only thing I can see are missing setup and teardown tags and and empty user tag in connection. These are allowed however, so not sure why this is happening without some help from the JDOM error message.

      I could probably build an adapter class to work aound the absence of chained exceptions, let me know if you are unable to upgrade and I can consider writing one.

      -sujit

       
    • Sujit Pal

      Sujit Pal - 2004-01-26

      Dennis,

      Were you able to upgrade and see the error message? Let me know if its a pain to upgrade, and I could write something that would conditionally compile if it detected a 1.3 JDK.

      -sujit

       
      • Anonymous

        Anonymous - 2004-01-27

        All is well with JDK 1.4.

        THx
        Dennis

         
    • Sujit Pal

      Sujit Pal - 2004-01-28

      Cool, thanks for the info.

      -sujit

       

Log in to post a comment.