ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Petar Tahchiev" <paranoia...@gmail.com>
Subject Re: Problem with Cactus and Ant
Date Tue, 30 Oct 2007 10:18:46 GMT
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 <paranoiabla@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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message