error with driverClass

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

error with driverClass

robyp

Ok i added into xml build file for ant the lines:

<classpath>

                    <pathelement location="${class.tests}"/>
                        fileset
dir="${lib}"><include name="*.jar"/> </fileset>
 </classpath>

But now i get
another kind of error :

<testcase classname="dbunitspike.TestDb" name="
testPrimo" time="0.047">
    <error message="driverClass is null" type="org.
dbunit.assertion.DbAssertionFailedError">org.dbunit.assertion.
DbAssertionFailedError: driverClass is null
        at org.dbunit.assertion.
DefaultFailureHandler$DefaultFailureFactory.createFailure(DefaultFailureHandler.
java:265)
        at org.dbunit.assertion.DefaultFailureHandler.createFailure
(DefaultFailureHandler.java:110)
        at org.dbunit.assertion.SimpleAssert.fail
(SimpleAssert.java:90)
        at org.dbunit.assertion.SimpleAssert.assertTrue
(SimpleAssert.java:77)
        at org.dbunit.assertion.SimpleAssert.
assertNotNullNorEmpty(SimpleAssert.java:61)
        at org.dbunit.JdbcDatabaseTester.
&lt;init&gt;(JdbcDatabaseTester.java:103)
        at org.dbunit.
PropertiesBasedJdbcDatabaseTester.&lt;init&gt;
(PropertiesBasedJdbcDatabaseTester.java:68)
        at org.dbunit.DBTestCase.
newDatabaseTester(DBTestCase.java:70)
        at org.dbunit.DatabaseTestCase.
getDatabaseTester(DatabaseTestCase.java:109)
        at org.dbunit.DatabaseTestCase.
setUp(DatabaseTestCase.java:151)
</error>
  </testcase>

why can't get the jdbc
string driver??.. if you watching xml attached in this email i added the jars
file in path(${lib} contains derby.jar (with Embedded Driver) , dbunit, junit,
slf4j)!
why can say to junit to run test and set driver properly? i do this at
begining of xml in <dbunit> ant tag, why this problem?

thank you
Roby
>----
Messaggio originale----
>Da: [hidden email]
>Data: 30/06/2009 17.58
>A:
<[hidden email]>
>Ogg:
>
>Hi to all
>
>i have a problem to
use Dbunit on derby database (JavaDB in
>Netbeans)
>
>I try to to write all
data to xml file : this work fine
>than i try
>to execute a TestClass but it
told me java.class.NotFound Exception
>
>In report
>dir into a TEST-
dbunitspike.TestDb.xml i get the following message:
>
><error
>message="
dbunitspike.TestDb" type="java.lang.ClassNotFoundException">java.lang.

>ClassNotFoundException: dbunitspike.TestDb
> at java.net.URLClassLoader$1.run
>
(URLClassLoader.java:200)
> at java.security.AccessController.doPrivileged
>
(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

>
>at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> at sun.misc.

>Launcher$AppClassLoader.loadClass(Launcher.java:301)
> at java.lang.
ClassLoader.
>loadClass(ClassLoader.java:252)
> at java.lang.ClassLoader.
loadClassInternal
>(ClassLoader.java:320)
> at java.lang.Class.forName0(Native
Method)
> at java.
>lang.Class.forName(Class.java:169)
></error>
>
>I attached
source and ant build
>file. I run ant file into Netbeans.Somebody can help me
what's going wrong??
>
>
>thank you!
>
>Roby


------------------------------------------------------------------------------

_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user

RunDbTest.xml (1K) Download Attachment
TestDb.java (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: error with driverClass

Matthias Gommeringer
Hi Roby,

you inherit from DbTestCase which needs some system properties to be set:

                System.setProperty(PropertiesBasedJdbcDatabaseTester.DBUNIT_DRIVER_CLASS, "XXX")
                System.setProperty(PropertiesBasedJdbcDatabaseTester.DBUNIT_CONNECTION_URL, "XXX")
                System.setProperty(PropertiesBasedJdbcDatabaseTester.DBUNIT_USERNAME, "XXX")
                System.setProperty(PropertiesBasedJdbcDatabaseTester.DBUNIT_PASSWORD, "XXX")
                System.setProperty(PropertiesBasedJdbcDatabaseTester.DBUNIT_SCHEMA, "XXX")

See step 2 in the howto at http://www.dbunit.org/howto.html

regards,
matthias


> -----Ursprüngliche Nachricht-----
> Von: <[hidden email]>, <[hidden email]>
> Gesendet: 01.07.09 10:15:18
> An: [hidden email]
> Betreff: [dbunit-user] error with driverClass
> Priorität: Hoch


>
> Ok i added into xml build file for ant the lines:
>
> <classpath>
>
>                     <pathelement location="${class.tests}"/>
> fileset
> dir="${lib}"><include name="*.jar"/> </fileset>
>  </classpath>
>
> But now i get
> another kind of error :
>
> <testcase classname="dbunitspike.TestDb" name="
> testPrimo" time="0.047">
>     <error message="driverClass is null" type="org.
> dbunit.assertion.DbAssertionFailedError">org.dbunit.assertion.
> DbAssertionFailedError: driverClass is null
> at org.dbunit.assertion.
> DefaultFailureHandler$DefaultFailureFactory.createFailure(DefaultFailureHandler.
> java:265)
> at org.dbunit.assertion.DefaultFailureHandler.createFailure
> (DefaultFailureHandler.java:110)
> at org.dbunit.assertion.SimpleAssert.fail
> (SimpleAssert.java:90)
> at org.dbunit.assertion.SimpleAssert.assertTrue
> (SimpleAssert.java:77)
> at org.dbunit.assertion.SimpleAssert.
> assertNotNullNorEmpty(SimpleAssert.java:61)
> at org.dbunit.JdbcDatabaseTester.
> &lt;init&gt;(JdbcDatabaseTester.java:103)
> at org.dbunit.
> PropertiesBasedJdbcDatabaseTester.&lt;init&gt;
> (PropertiesBasedJdbcDatabaseTester.java:68)
> at org.dbunit.DBTestCase.
> newDatabaseTester(DBTestCase.java:70)
> at org.dbunit.DatabaseTestCase.
> getDatabaseTester(DatabaseTestCase.java:109)
> at org.dbunit.DatabaseTestCase.
> setUp(DatabaseTestCase.java:151)
> </error>
>   </testcase>
>
> why can't get the jdbc
> string driver??.. if you watching xml attached in this email i added the jars
> file in path(${lib} contains derby.jar (with Embedded Driver) , dbunit, junit,
> slf4j)!
> why can say to junit to run test and set driver properly? i do this at
> begining of xml in <dbunit> ant tag, why this problem?
>
> thank you
> Roby
> >----
> Messaggio originale----
> >Da: [hidden email]
> >Data: 30/06/2009 17.58
> >A:
> <[hidden email]>
> >Ogg:
> >
> >Hi to all
> >
> >i have a problem to
> use Dbunit on derby database (JavaDB in
> >Netbeans)
> >
> >I try to to write all
> data to xml file : this work fine
> >than i try
> >to execute a TestClass but it
> told me java.class.NotFound Exception
> >
> >In report
> >dir into a TEST-
> dbunitspike.TestDb.xml i get the following message:
> >
> ><error
> >message="
> dbunitspike.TestDb" type="java.lang.ClassNotFoundException">java.lang.
>
> >ClassNotFoundException: dbunitspike.TestDb
> > at java.net.URLClassLoader$1.run
> >
> (URLClassLoader.java:200)
> > at java.security.AccessController.doPrivileged
> >
> (Native Method)
> > at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>
> >
> >at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> > at sun.misc.
>
> >Launcher$AppClassLoader.loadClass(Launcher.java:301)
> > at java.lang.
> ClassLoader.
> >loadClass(ClassLoader.java:252)
> > at java.lang.ClassLoader.
> loadClassInternal
> >(ClassLoader.java:320)
> > at java.lang.Class.forName0(Native
> Method)
> > at java.
> >lang.Class.forName(Class.java:169)
> ></error>
> >
> >I attached
> source and ant build
> >file. I run ant file into Netbeans.Somebody can help me
> what's going wrong??
> >
> >
> >thank you!
> >
> >Roby
>
>
>
> <hr>
> ------------------------------------------------------------------------------
>
>
> <hr>
> _______________________________________________
> dbunit-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/dbunit-user
>
>


______________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de


------------------------------------------------------------------------------
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user