I try to run JUNIT test with eclipse and ANT they both are complainen that org.h2.Driver class is not found.
I have h2-1.3.164.jar in my classpath and for proof about it here is classpath from system property java.class.path
c:\trasferer\build;
C:\Program Files (x86)\IBM\IMShared\plugins\org.junit4_4.3.1\junit.jar;
c:\trasferer\lib\ojdbc6.jar;
c:\trasferer\lib\sqljdbc4.jar;
c:\trasferer\lib-test\h2-1.3.164.jar;
c:\trasferer\lib-test\junit-4.8.2.jar;
c:\trasferer\lib-test\log4j-1.2.14.jar;
c:\trasferer\lib-test\TestUtils.jar;
c:\trasferer\lib-test\dbunit-2.4.8.jar;
c:\trasferer\lib-test\slf4j-api-1.5.5.jar;
c:\trasferer\lib-test\slf4j-log4j12-1.5.5.jar;
and I can found class org.h2.Driver from h2-1.3.164.jar when I open it with eclipse. Ant task for running test and ANT tasks for "build" classpath
<path id="lib.classpath">
<fileset dir="./lib" includes="*.jar" />
</path>
<path id="test.classpath">
<fileset dir="lib" includes="*.jar" />
<fileset dir="lib-test" includes="*.jar" />
<pathelement location="${dest}" />
<pathelement location="${test-dest}" />
</path>
<target name="run-test" depends="init-test,compile,compile-test">
<property name="classPathToUse" refid="test.classpath" />
<echo>Using classpath: "${classPathToUse}"</echo>
<junit failureProperty="test.failure" fork="on" forkmode="once" outputtoformatters="true" printsummary="on" showoutput="true">
<jvmarg value="-Xmx512m" />
<jvmarg value="-XX:MaxPermSize=128m" />
<jvmarg value="-Duser.timezone=GMT" />
<jvmarg value="-Dexternal-properties=${test.properties}" />
<classpath refid="test.classpath" />
<formatter type="brief" usefile="false" />
<formatter type="xml" />
<batchtest todir="test-results">
<fileset dir="${test-dest}" includes="**/*Test.class" />
</batchtest>
</junit>
<fail message="test failed" if="test.failure" />
</target>
and here is stacktrace
[junit] ------------- Standard Error -----------------
[junit] log4j:ERROR Could not find value for key log4j.appender.CONSOLE
[junit] log4j:ERROR Could not instantiate appender named "CONSOLE".
[junit] log4j:WARN No appenders could be found for logger (org.dbunit.DatabaseTestCase).
[junit] log4j:WARN Please initialize the log4j system properly.
[junit] ------------- ---------------- ---------------
[junit] Testcase: testBuildLiityntapisteSQL(org.xyz.rigistry.manager.XXServiceImplTest): Caused an ERROR
[junit] org.h2.Driver
[junit] java.lang.ClassNotFoundException: org.h2.Driver
[junit] at java.lang.Class.forName(Class.java:136)
[junit] at org.dbunit.JdbcDatabaseTester.(JdbcDatabaseTester.java:104)
[junit] at org.dbunit.PropertiesBasedJdbcDatabaseTester.(PropertiesBasedJdbcDatabaseTester.java:68)
[junit] at org.dbunit.DBTestCase.newDatabaseTester(DBTestCase.java:70)
[junit] at org.dbunit.DatabaseTestCase.getDatabaseTester(DatabaseTestCase.java:109)
[junit] at org.dbunit.DatabaseTestCase.setUp(DatabaseTestCase.java:151)
[junit] at fi.transferer.junit.AbstractDatabaseTestCase.setUp(Unknown Source)
[junit] at fi.transferer.junit.BasicDatabaseTestCase.setUp(Unknown Source)
So could someone tell me what is going on, please?