Click to See Complete Forum and Search --> : Test Failed : Incompatible magic value -272646673 in class file AddressDaoTest


md_sagri
April 6th, 2007, 07:00 AM
Hi
I am using appfuse.
I am writing test class for AddressDao and using JUnit and JMock for testing the same class. When I run the ant command ant test-dao the following exception is given.
[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] Incompatible magic value -272646673 in class file AddressDaoTest
[junit] java.lang.ClassFormatError: Incompatible magic value -272646673 in class file 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

Can any one tell me what migh tbe the reason.
in my ant script, I am first compiling the test class, loading the DB with xml data,
then check-debug which is defined below
<target name="check-debug" depends="with-debug" />

<target name="with-debug" if="appfuse-debug">
<property name="run.appfuse.test.debugargline" value="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y"/>
<echo>Running in debug mode : Listening on port 4000 ...</echo>
</target>
after this the control goes to <test-module module="testDao" />
where testDao is the package name in which my test class is written.

This class is executed correctly because the junit message shows this
[junit] Running AddressDaoTest

if any one knows what exactly is happenning please reply.

Thanks

md_sagri
April 7th, 2007, 06:58 AM
I resolved this problem
The problem was that the junit was not able to find the .class file.
It gives this error when the compiler founds that the type of the file is not class