ClassNotFoundException ant, junit, eclipse

View: New views
2 Messages — Rating Filter:   Alert me  

ClassNotFoundException ant, junit, eclipse

by mfugleru :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello, I am trying to build my java project with a build.xml file using ant in eclipse.
The problem is the JUnit part of the build (it builds sucessfull without the JUnit task).
The structure is as follows:

---> MyProject
-----------> src
-----------> test

There seems to be a problem with not finding my Test-class.
ClassNotFoundException: XTest
I have pasted the stacktrace below:
Anybody who can help me please?

Cheers,

Magnus




Buildfile: C:\Documents and Settings\mfugleru\workspace\Modulis\build.xml
init:
    [mkdir] Created dir: C:\Documents and Settings\mfugleru\workspace\Modulis\build
init:
compile:
    [javac] Compiling 1 source file to C:\Documents and Settings\mfugleru\workspace\Modulis\build
    [javac] Compiling 1 source file to C:\Documents and Settings\mfugleru\workspace\Modulis\build
dist:
    [mkdir] Created dir: C:\Documents and Settings\mfugleru\workspace\Modulis\dist\lib
      [jar] Building jar: C:\Documents and Settings\mfugleru\workspace\Modulis\dist\lib\MyProject-20080801.jar
init:
compile:
clean:
   [delete] Deleting directory C:\Documents and Settings\mfugleru\workspace\Modulis\build
   [delete] Deleting directory C:\Documents and Settings\mfugleru\workspace\Modulis\dist
test:
    [junit] Running XTest
    [junit] Testsuite: XTest
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
    [junit] Null Test: Caused an ERROR
    [junit] XTest
    [junit] java.lang.ClassNotFoundException: XTest
    [junit] at java.net.URLClassLoader$1.run(Unknown Source)
    [junit] at java.security.AccessController.doPrivileged(Native Method)
    [junit] at java.net.URLClassLoader.findClass(Unknown Source)
    [junit] at java.lang.ClassLoader.loadClass(Unknown Source)
    [junit] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    [junit] at java.lang.ClassLoader.loadClass(Unknown Source)
    [junit] at java.lang.ClassLoader.loadClass(Unknown Source)
    [junit] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    [junit] at java.lang.Class.forName0(Native Method)
    [junit] at java.lang.Class.forName(Unknown Source)
    [junit] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
    [junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
    [junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)

BUILD FAILED
C:\Documents and Settings\mfugleru\workspace\Modulis\build.xml:44: Test XTest failed

Total time: 906 milliseconds

Re: ClassNotFoundException ant, junit, eclipse

by David Saff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Magnus,

Sorry for a very late response.  Did you find an answer?

   David Saff

On Fri, Aug 1, 2008 at 7:47 AM, mfugleru <mfugle-1@...> wrote:

>
> Hello, I am trying to build my java project with a build.xml file using ant
> in eclipse.
> The problem is the JUnit part of the build (it builds sucessfull without the
> JUnit task).
> The structure is as follows:
>
> ---> MyProject
> -----------> src
> -----------> test
>
> There seems to be a problem with not finding my Test-class.
> ClassNotFoundException: XTest
> I have pasted the stacktrace below:
> Anybody who can help me please?
>
> Cheers,
>
> Magnus
>
> Buildfile: C:\Documents and Settings\mfugleru\workspace\Modulis\build.xml
> init:
> [mkdir] Created dir: C:\Documents and
> Settings\mfugleru\workspace\Modulis\build
> init:
> compile:
> [javac] Compiling 1 source file to C:\Documents and
> Settings\mfugleru\workspace\Modulis\build
> [javac] Compiling 1 source file to C:\Documents and
> Settings\mfugleru\workspace\Modulis\build
> dist:
> [mkdir] Created dir: C:\Documents and
> Settings\mfugleru\workspace\Modulis\dist\lib
> [jar] Building jar: C:\Documents and
> Settings\mfugleru\workspace\Modulis\dist\lib\MyProject-20080801.jar
> init:
> compile:
> clean:
> [delete] Deleting directory C:\Documents and
> Settings\mfugleru\workspace\Modulis\build
> [delete] Deleting directory C:\Documents and
> Settings\mfugleru\workspace\Modulis\dist
> test:
> [junit] Running XTest
> [junit] Testsuite: XTest
> [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
> [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
> [junit] Null Test: Caused an ERROR
> [junit] XTest
> [junit] java.lang.ClassNotFoundException: XTest
> [junit] at java.net.URLClassLoader$1.run(Unknown Source)
> [junit] at java.security.AccessController.doPrivileged(Native Method)
> [junit] at java.net.URLClassLoader.findClass(Unknown Source)
> [junit] at java.lang.ClassLoader.loadClass(Unknown Source)
> [junit] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> [junit] at java.lang.ClassLoader.loadClass(Unknown Source)
> [junit] at java.lang.ClassLoader.loadClass(Unknown Source)
> [junit] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> [junit] at java.lang.Class.forName0(Native Method)
> [junit] at java.lang.Class.forName(Unknown Source)
> [junit] at
> org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
> [junit] at
> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
> [junit] at
> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
>
> BUILD FAILED
> C:\Documents and Settings\mfugleru\workspace\Modulis\build.xml:44: Test
> XTest failed
>
> Total time: 906 milliseconds
> --
> View this message in context:
> http://www.nabble.com/ClassNotFoundException-ant%2C-junit%2C-eclipse-tp18773107p18773107.html
> Sent from the JUnit - User mailing list archive at Nabble.com.
>
>