Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
542 views
in Technique[技术] by (71.8m points)

Suddenly can't run TestNG tests from ant ([testng] Caused by: java.lang.ClassNotFoundException: com.beust.jcommander.ParameterException)

I am using ant and TestNG 6.1.1, and I had my tests working just fine yesterday. Today when I try to run the tests I get a NoClassDefFoundError involving com/beust/jcommander/ParamException. Here is the output:

[copy] Copying 1 file to /Users/djohnson/src/webapp/components/build/tmp
[testng] Exception in thread "main" java.lang.NoClassDefFoundError: com/beust/jcommander/ParameterException
[testng] Caused by: java.lang.ClassNotFoundException: com.beust.jcommander.ParameterException
[testng]    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[testng]    at java.security.AccessController.doPrivileged(Native Method)
[testng]    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[testng]    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[testng]    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[testng]    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[testng] The tests failed.

Here is the .xml file I'm using:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Single Method Suite">
  <test name="Single Method Test">
    <classes>
      <class name="DhcpTest">
        <methods>
          <exclude name=".*" />
          <include name="setGetEnabledTest" />
        </methods>
      </class>
    </classes>
  </test>
</suite>

I've also specified the complete path for the class with no luck. I've checked the classpath and everything seems fine, does anyone have any ideas on this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you're using ant, JCommander should be inside testng.jar, so I'm thinking your testng.jar file might be corrupt.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...