Problem with ANT and java.util.NoSuchElementException

85 views
Skip to first unread message

Randy

unread,
Jun 4, 2009, 3:56:44 PM6/4/09
to mxunit
So, I am trying to setup an ANT target for a project i am working on.
I am running Railo and using the java 1.5 jar.

In the verbose mode mxunit shows the output to run the tests and it
shows the url used to run the tests. After the url is run it dies with
the error: java.util.NoSuchElementException

I opened the url that it was showing that it was using to run the
tests and it doesn't show any errors (in fact i put the output into an
xml file and opened it in eclipse with the JUnit view and showed that
all the tests passed)

Any ideas that I could try to figure out what is happening in the ant
build? I've looked at the error log for eclipse and didn't see
anything there.

Thanks,

Randy

bill shelton

unread,
Jun 4, 2009, 4:06:34 PM6/4/09
to mxunit
Randy,

I'll try to reproduce that tonight. Can you give me the following to
help trouble shoot?

* Your OS and Railo version.
* Run the ant task using the -v (verbose) option and post the stack
trace.


bill

Randy

unread,
Jun 4, 2009, 4:59:12 PM6/4/09
to mxunit
I am running OS X 10.5.7 with railo-express 3.1.0.015 and java
1.5.0_16

And here is the stack trace:

BUILD FAILED
/Users/randy/Projects/cf-c/trunk/build.xml:35:
java.util.NoSuchElementException
at org.mxunit.ant.MXUnitAntTask.doTest(MXUnitAntTask.java:351)
at org.mxunit.ant.MXUnitAntTask.runDirectoryTests(MXUnitAntTask.java:
290)
at org.mxunit.ant.MXUnitAntTask.execute(MXUnitAntTask.java:203)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:
288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
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:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
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.util.NoSuchElementException
at java.util.StringTokenizer.nextToken(StringTokenizer.java:332)
at org.mxunit.ant.HttpHelper.getTestResultSummary(HttpHelper.java:
190)
at org.mxunit.ant.MXUnitAntTask.doTest(MXUnitAntTask.java:301)
... 19 more
--- Nested Exception ---
java.util.NoSuchElementException
at java.util.StringTokenizer.nextToken(StringTokenizer.java:332)
at org.mxunit.ant.HttpHelper.getTestResultSummary(HttpHelper.java:
190)
at org.mxunit.ant.MXUnitAntTask.doTest(MXUnitAntTask.java:301)
at org.mxunit.ant.MXUnitAntTask.runDirectoryTests(MXUnitAntTask.java:
290)
at org.mxunit.ant.MXUnitAntTask.execute(MXUnitAntTask.java:203)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:
288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
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:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

Thanks,

Randy

Randy

unread,
Jun 4, 2009, 5:03:47 PM6/4/09
to mxunit
Also,

In case it will help any I've have the following for the ant task:

<mxunittask server="localhost" port="8888" outputdir="${basedir}/unit"
defaultrunner="/cf-c/mxunit/runner/HttpAntRunner.cfc" verbose="true"
haltonerror="true">
<directory path="${basedir}/test" componentPath="cf-c.test"
recurse="true" />
</mxunittask>

The project is checked out into a sub directory of the webroot (cf-c)
and there is a mapping for the mxunit. (the mxunit eclipse plugin
works fine with the mappings that are in place so I believe that the
ant task should have no problems with it)

Randy

bill shelton

unread,
Jun 5, 2009, 8:21:57 AM6/5/09
to mxunit
Randy,

Short answer: Railo, or it's web server, appears to double-encode
Cookies, which we use to persist test summaries across multiple http
requests. It's a comma-delimited list of test runs, failures, errors,
and total time. This cookie, decoded, in ColdFusion looks something
like this:

Set-Cookie: MXUNIT_SUMMARY=28,0,0,479;path=/

However, Railo Express returns the decoded cookie like so:
*Set-Cookie: MXUNIT_SUMMARY=28%2C1%2C4%2C107;path=/

If I decode it again, it looks correct: *Set-Cookie:
MXUNIT_SUMMARY=28,1,4,107;path=/

At first glance, it appears that Railo or Resin is double-encoding the
cookie, but I suspect it might be another encoding issue I'm missing -
maybe something to do with locale or some other incompatibility. I'm
certainly open to suggestions here.

Sorry, but no workaround yet.

bill

bill shelton

unread,
Jun 5, 2009, 10:29:20 AM6/5/09
to mxunit
Note to self: Railo Express is built on Jetty.

Randy

unread,
Jun 5, 2009, 2:26:28 PM6/5/09
to mxunit
So you have been able to reproduce the error alright? Do you need
other information?

Randy

bill shelton

unread,
Jun 5, 2009, 2:32:46 PM6/5/09
to mxunit
Yep. Reproduced no problem. It appears not to be a Java 5 or Java 6
problem, but with how Railo encodes cookies. This is not a problem if
you're using cfcookie, but reading a cookie using httpclient is
another issue. Again, it "appears" to be double encoded, which seems
weir to me.

bill

bill shelton

unread,
Jun 9, 2009, 11:18:55 AM6/9/09
to mxunit
FYI, I posted a message to the Railo board over the weekend, but have
not received a response. I'll also take this off line with Randy and
post the solution when available.

bill

Randy

unread,
Jul 20, 2009, 3:28:47 PM7/20/09
to mxunit
After pursuing the thread on the railo group for a bit it *appears*
that the issue is with the jetty implementation since I tried it on
the resin express and it seemed to work fine. Not sure what can be
done to fix it for the Jetty or if it is even a bug for sure with
Jetty.

Randy

bill shelton

unread,
Jul 20, 2009, 5:20:36 PM7/20/09
to mxunit
Thanks for pursuing that, Randy. I suspected it was at the http header
level. I might poke around the Jetty and see what they say.

bill

Peter J. Farrell

unread,
Jul 20, 2009, 5:36:12 PM7/20/09
to mxu...@googlegroups.com
There was a thread on the open BD about jetty truncating headers on IE especially. There is an xml setting for jetty that increases the max byte size for headers. Have no clue if this even applies - just saw railo, jetty and headers mentioned and I thought of this.

.Pjf
-----Original Message-----
From: bill shelton <vir...@gmail.com>

Date: Mon, 20 Jul 2009 14:20:36
To: mxunit<mxu...@googlegroups.com>
Subject: [mxunit:1378] Re: Problem with ANT and
java.util.NoSuchElementException
Reply all
Reply to author
Forward
0 new messages