ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: Problem with Cactus and Ant
Date Mon, 29 Oct 2007 11:59:21 GMT
Petar Tahchiev wrote:
> Hi guys,
> 
> my name is Petar Tahchiev and I am one of the developers of Jakarta Cactus.
> I have a really strange problem, when using Ant > 1.6.5.

Hi peter, glad to get some of the cactus folk involved.

> When trying to execute my cactus tasks, I invoke actually the JunitTask, I
> get the
> following exception:
> -----------------------------------------------------------------------------
> /home/peter/bin/workspace/TestCactus/build.xml:93:
> java.lang.NullPointerException
>         at org.apache.tools.ant.dispatch.DispatchUtils.execute(
> DispatchUtils.java:115)
>         at org.apache.tools.ant.Task.perform(Task.java:348)
>         at org.apache.tools.ant.Target.execute(Target.java:357)
>         at org.apache.tools.ant.Target.performTasks(Target.java:385)
>         at org.apache.tools.ant.Project.executeSortedTargets(Project.java
> :1329)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
>         at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(
> DefaultExecutor.java:41)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>         at org.apache.tools.ant.Main.runBuild(Main.java:758)
>         at org.apache.tools.ant.Main.startAnt(Main.java:217)
>         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
>         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
> Caused by: java.lang.NullPointerException
>         at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(
> JUnitTask.java:1272)
>         at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(
> JUnitTask.java:823)
>         at org.apache.cactus.integration.ant.CactusTask.executeInContainer(
> CactusTask.java:453)
>         at org.apache.cactus.integration.ant.CactusTask.execute(
> CactusTask.java:204)
>         at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java
> :288)
>         at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.apache.tools.ant.dispatch.DispatchUtils.execute(
> DispatchUtils.java:105)
>         ... 11 more
> --- Nested Exception ---
> java.lang.NullPointerException
>         at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(
> JUnitTask.java:1272)
>         at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(
> JUnitTask.java:823)
>         at org.apache.cactus.integration.ant.CactusTask.executeInContainer(
> CactusTask.java:453)
>         at org.apache.cactus.integration.ant.CactusTask.execute(
> CactusTask.java:204)
>         at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java
> :288)
>         at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.apache.tools.ant.dispatch.DispatchUtils.execute(
> DispatchUtils.java:105)
>         at org.apache.tools.ant.Task.perform(Task.java:348)
>         at org.apache.tools.ant.Target.execute(Target.java:357)
>         at org.apache.tools.ant.Target.performTasks(Target.java:385)
>         at org.apache.tools.ant.Project.executeSortedTargets(Project.java
> :1329)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
>         at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(
> DefaultExecutor.java:41)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>         at org.apache.tools.ant.Main.runBuild(Main.java:758)
>         at org.apache.tools.ant.Main.startAnt(Main.java:217)
>         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
>         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
> 
> Total time: 8 seconds
> ------------------------------------------------------------------------------------------------
> 
> However, if I downgrade to Ant 1.6.5 I don't get this exception and
> everything passes
> smoothly. Looking at the source code of the task, on line 1272 here is what
> we see:
> 
> runner = delegate.newJUnitTestRunner(test, test.getHaltonerror(),
>                                          test.getFiltertrace(),
>                                          test.getHaltonfailure(), false,
>                                          true, classLoader);
> so it turns out that delegate is null !!!

or test is null.

 > In Ant 1.6.5. there seems that this "delegate" object is missing.

Its an addition that lets Ant load junit if it is on the classpath of 
the tests; there's no longer any need to have it on ant's own classpath. 
We don't plan to roll back to the old design, so the problem with Cactus 
becomes one of determining hw
 > Also when
 > we look on line 799
 > we see that delegate is explicitly nullified:
 > ------------------------------------------------
 >
 >  delegate = null;
 >
 > ------------------------------------------------
 >

but if you look at execute(), you see

delegate = createMirror(this, mirrorLoader);

How does cactus override execute()? Does it call super.execute(), or 
does it do something else? If you point us at the SVN copy of the task, 
we can look for ourselves and see.  It may be that you are calling some 
internal execution stuff before a delegate is set up

-- 
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message