You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Petar Tahchiev <pa...@gmail.com> on 2007/10/28 19:10:13 UTC

Problem with Cactus and Ant

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.
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 !!!
In Ant 1.6.5. there seems that this "delegate" object is missing. Also when
we look on line 799
we see that delegate is explicitly nullified:
------------------------------------------------

 delegate = null;

------------------------------------------------

????

Does these thoughts make any sense, and if yes, how can I resolve my
problems.

Thank you.

-- 
Regards, Petar!
Karlovo, Bulgaria.

EOOXML Objections
http://www.grokdoc.net/index.php/EOOXML_objections

Public PGP Key at:
https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611

Re: Problem with Cactus and Ant

Posted by Peter Reilly <pe...@gmail.com>.
It may be easier to copy all of junittask and modify it rather
than extending it.

JUnitTask is  complicated and tricky - it needs to handle
classloading to allow junit.jar to be placed in a nested <classpath>

Details on the implementation will change from ant release to ant
release - the task
(and most others!) should have been made final when first written..

Peter


On 10/30/07, Petar Tahchiev <pa...@gmail.com> wrote:
> So actually you have to look here:
> http://svn.apache.org/repos/asf/jakarta/cactus/trunk/integration/ant/src/java/org/apache/cactus/integration/ant/CactusTask.java
> and this is the peace of code that actually executes the test:
> ===========================================
>
> private void executeInContainer(ContainerWrapper theWrapper,
>         DeployableFile theFile)
>     {
>         log("Starting up container", Project.MSG_VERBOSE);
>         ContainerRunner runner = new ContainerRunner(theWrapper);
>         runner.setLogger(new AntLogger(getProject()));
>         try
>         {
>             URL url = new URL(theWrapper.getBaseURL() + "/"
>                 + theFile.getTestContext()
>                 + theFile.getServletRedirectorMapping()
>                 + "?Cactus_Service=RUN_TEST");
>             runner.setURL(url);
>
>             runner.startUpContainer();
>             log("Server name retrieved from 'Server' HTTP header: ["
>                 + runner.getServerName() + "]", Project.MSG_VERBOSE);
>             try
>             {
>                 Enumeration tests = getIndividualTests();
>                 while (tests.hasMoreElements())
>                 {
>                     JUnitTest test = (JUnitTest) tests.nextElement();
>                     if (test.shouldRun(getProject())
>                      && !theWrapper.isExcluded(test.getName()))
>                     {
>                         if (theWrapper.getToDir() != null)
>                         {
>                             test.setTodir(theWrapper.getToDir());
>                         }
>                         execute(test);
>                     }
>                 }
>             }
>             finally
>             {
>                 log("Shutting down container", Project.MSG_VERBOSE);
>                 runner.shutDownContainer();
>                 log("Container shut down", Project.MSG_VERBOSE);
>             }
>         }
> ===========================================
>
> and the test-case in "execute(test)" is NOT null - I explicitly checked it.
> In my opinion the only reason for the NLP is because the delegate
> object is null :-(.
>
> Any suggestions?
>
> 2007/10/28, Petar Tahchiev <pa...@gmail.com>:
> >
> > 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.
> > 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 !!!
> > In Ant 1.6.5. there seems that this "delegate" object is missing. Also
> > when we look on line 799
> > we see that delegate is explicitly nullified:
> > ------------------------------------------------
> >
> >  delegate = null;
> >
> > ------------------------------------------------
> >
> > ????
> >
> > Does these thoughts make any sense, and if yes, how can I resolve my
> > problems.
> >
> > Thank you.
> >
> > --
> > Regards, Petar!
> > Karlovo, Bulgaria.
> >
> > EOOXML Objections
> > http://www.grokdoc.net/index.php/EOOXML_objections
> >
> > Public PGP Key at: https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
> >
> > Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611
>
>
>
>
> --
> Regards, Petar!
> Karlovo, Bulgaria.
>
> EOOXML Objections
> http://www.grokdoc.net/index.php/EOOXML_objections
>
> Public PGP Key at:
> https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
> Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611
>

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


Re: Problem with Cactus and Ant

Posted by Petar Tahchiev <pa...@gmail.com>.
So actually you have to look here:
http://svn.apache.org/repos/asf/jakarta/cactus/trunk/integration/ant/src/java/org/apache/cactus/integration/ant/CactusTask.java
and this is the peace of code that actually executes the test:
===========================================

private void executeInContainer(ContainerWrapper theWrapper,
        DeployableFile theFile)
    {
        log("Starting up container", Project.MSG_VERBOSE);
        ContainerRunner runner = new ContainerRunner(theWrapper);
        runner.setLogger(new AntLogger(getProject()));
        try
        {
            URL url = new URL(theWrapper.getBaseURL() + "/"
                + theFile.getTestContext()
                + theFile.getServletRedirectorMapping()
                + "?Cactus_Service=RUN_TEST");
            runner.setURL(url);

            runner.startUpContainer();
            log("Server name retrieved from 'Server' HTTP header: ["
                + runner.getServerName() + "]", Project.MSG_VERBOSE);
            try
            {
                Enumeration tests = getIndividualTests();
                while (tests.hasMoreElements())
                {
                    JUnitTest test = (JUnitTest) tests.nextElement();
                    if (test.shouldRun(getProject())
                     && !theWrapper.isExcluded(test.getName()))
                    {
                        if (theWrapper.getToDir() != null)
                        {
                            test.setTodir(theWrapper.getToDir());
                        }
                        execute(test);
                    }
                }
            }
            finally
            {
                log("Shutting down container", Project.MSG_VERBOSE);
                runner.shutDownContainer();
                log("Container shut down", Project.MSG_VERBOSE);
            }
        }
===========================================

and the test-case in "execute(test)" is NOT null - I explicitly checked it.
In my opinion the only reason for the NLP is because the delegate
object is null :-(.

Any suggestions?

2007/10/28, Petar Tahchiev <pa...@gmail.com>:
>
> 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.
> 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 !!!
> In Ant 1.6.5. there seems that this "delegate" object is missing. Also
> when we look on line 799
> we see that delegate is explicitly nullified:
> ------------------------------------------------
>
>  delegate = null;
>
> ------------------------------------------------
>
> ????
>
> Does these thoughts make any sense, and if yes, how can I resolve my
> problems.
>
> Thank you.
>
> --
> Regards, Petar!
> Karlovo, Bulgaria.
>
> EOOXML Objections
> http://www.grokdoc.net/index.php/EOOXML_objections
>
> Public PGP Key at: https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
>
> Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611




-- 
Regards, Petar!
Karlovo, Bulgaria.

EOOXML Objections
http://www.grokdoc.net/index.php/EOOXML_objections

Public PGP Key at:
https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611

Re: Problem with Cactus and Ant

Posted by Steve Loughran <st...@apache.org>.
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