Click to See Complete Forum and Search --> : ClassNotFoundException:


md_sagri
April 7th, 2007, 06:05 AM
I have the following out put for my test-dao
compile-dao-tests:
[echo] Compiling testDao...
[javac] Compiling 1 source file to /home/quayum/lastDay/collegeDB/eservrepos/eservices/trunk/build/eapphr/WEB-INF/classes
[echo] compilation of test comleted
init:
Trying to override old definition of task propertycopy
prepare:
db-load:
[dbunit] Executing operation: CLEAN_INSERT
[dbunit] on file: /DB/eserv/sample-data.xml
[dbunit] with format: xml
with-debug:
no-debug:
check-debug:
test-dao:
[echo] Testing testDao...
[junit] Running AddressDaoTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit] Testsuite: AddressDaoTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit] Caused an ERROR
[junit] AddressDaoTest (wrong name: com/infistech/eservices/apps/hr/testDao/AddressDaoTest)
[junit] java.lang.NoClassDefFoundError: AddressDaoTest (wrong name: com/infistech/eservices/apps/hr/testDao/AddressDaoTest)
[junit] at java.lang.ClassLoader.defineClass1(Native Method)
[junit] at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
[junit] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
[junit] at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
[junit] at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
[junit] at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
[junit] at java.security.AccessController.doPrivileged(Native Method)
[junit] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[junit] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
[junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
[junit] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
[junit] at java.lang.Class.forName0(Native Method)
[junit] at java.lang.Class.forName(Class.java:164)
[junit] Test AddressDaoTest FAILED

BUILD FAILED

the code for junit is as follows:

<batchtest todir="${test.dir}/data" if="testcase">
<fileset dir="${frameworkclasses.dir}/com/infistech/eservices/apps/hr/@{module}">
<include name="**/*${testcase}*"/>
<exclude name="**/*TestCase.class"/>
<exclude name="**/*$*.class" />
</fileset>
</batchtest>
<batchtest todir="${test.dir}/data" unless="testcase">
<fileset dir="${frameworkclasses.dir}/com/infistech/eservices/apps/hr/@{module}">
<include name="**/*Test.class*"/>
<include name="**/*TestCase.class"/>
<exclude name="**/*$*.class" />
</fileset>
</batchtest>

can any one please help

md_sagri
April 7th, 2007, 06:59 AM
Resolved it by removing that extra path from the junit code.
Now my <batchtest looks like this
<batchtest todir="${test.dir}/data" if="testcase">
<fileset dir="${frameworkclasses.dir}/com/infistech/eservices/apps/hr/@{module}">
<include name="**/*${testcase}*"/>
<exclude name="**/*TestCase.class"/>
<exclude name="**/*$*.class" />
</fileset>
</batchtest>
<batchtest todir="${test.dir}/data" unless="testcase">
<fileset dir="${test.dir}/@{module}/classes">
<include name="**/*Test.class*"/>
<include name="**/*TestCase.class"/>
<exclude name="**/*$*.class" />
</fileset>
</batchtest>

dglienna
April 14th, 2007, 02:48 AM
test


Hi and welcome to the forums....

Firstly please use code tags when pasting blocks of code.. .. Your Code .... It just makes it so much easier to read and identify. Also this way you may get more responces as many members will skip over the post if it is not ledgible..

Back to your problem.. Another case could be that Remittance(ArrayLine, 1) could include some characters that are not valid for filenames[!@#^&*"] including acented characters...