• Post Reply Bookmark Topic Watch Topic
  • New Topic

NullPointer running junit on DOMElementWriter.encode  RSS feed

Bob Peterson
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm trying to run junit from ant. My ant build is 1.6.2. I'm getting the error below. I googled this and found very little, the only suggestion I found was that the problem was caused by multiple installations of ant on classpath. I'm running it from the command line and have tried running it in verbose mode to see the classpath and I don't see multiple ants there.

Also, when I run it from inside eclipse, it still can't find the junit task. Maybe that sheds some light on what's going on with classpath issues. I had that same problem earlier when running from the command line, but fixed it by adding ant-junit.jar to the %ANT_HOME%/lib directory, where junit.jar is located also.

Appreciate any help. Thanks

(Sorry about the formatting, wasn't sure whether to use code or not)

Error :

[junit] java.lang.NullPointerException
[junit] at org.apache.tools.ant.util.DOMElementWriter.encode(DOMElementWriter.java:174)
[junit] at org.apache.tools.ant.util.DOMElementWriter.write(DOMElementWriter.java:95)
[junit] at org.apache.tools.ant.util.DOMElementWriter.write(DOMElementWriter.java:113)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.endTestSuite(XMLJUnitResultFormatter.java:133)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.fireEndTestSuite(JUnitTestRunner.java:440)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:313)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:656)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:558)
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!