org.testng.TestNGException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Occasionally we have some test which lets Surefire fail hard which Hudson doesn't recognize. I.e. the tests are not executed, but the build result is still success. E.g. we had a test which failed with a NoSuchFieldException in the constructor of the test class: Running TestSuite log4j:WARN No appenders could be found for logger (...). log4j:WARN Please initialize the log4j system properly. org.apache.maven.surefire.booter.SurefireExecutionException: Cannot instantiate class XyzTest; nested exception is org.testng.TestNGException: Cannot instantiate class XyzTest org.testng.TestNGException: Cannot instantiate class XyzTest at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:35) at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:330) at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:62) at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:81) at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:114) at org.testng.TestRunner.initMethods(TestRunner.java:289) at org.testng.TestRunner.init(TestRunner.java:235) at org.testng.TestRunner.init(TestRunner.java:197) at org.testng.TestRunner.<init>(TestRunner.java:141) at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:488) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:250) at org.testng.SuiteRunner.run(SuiteRunner.java:204) at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:877) at org.testng.TestNG.runSuitesLocally(TestNG.java:842) at org.testng.TestNG.run(TestNG.java:751) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:141) at org.apache.maven.surefire.Surefire.run(Surefire.java:180) 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:597) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:26) ... 23 more Caused by: java.lang.NoSuchFieldException: cipherService at java.lang.Class.getDeclaredField(Class.java:1882) at XyzTest.<init>(XyzTest.java:91) ... 28 more [ERROR] There are test failures.
    via by kutzi,
  • Occasionally we have some test which lets Surefire fail hard which Hudson doesn't recognize. I.e. the tests are not executed, but the build result is still success. E.g. we had a test which failed with a NoSuchFieldException in the constructor of the test class: Running TestSuite log4j:WARN No appenders could be found for logger (...). log4j:WARN Please initialize the log4j system properly. org.apache.maven.surefire.booter.SurefireExecutionException: Cannot instantiate class XyzTest; nested exception is org.testng.TestNGException: Cannot instantiate class XyzTest org.testng.TestNGException: Cannot instantiate class XyzTest at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:35) at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:330) at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:62) at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:81) at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:114) at org.testng.TestRunner.initMethods(TestRunner.java:289) at org.testng.TestRunner.init(TestRunner.java:235) at org.testng.TestRunner.init(TestRunner.java:197) at org.testng.TestRunner.<init>(TestRunner.java:141) at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:488) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:250) at org.testng.SuiteRunner.run(SuiteRunner.java:204) at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:877) at org.testng.TestNG.runSuitesLocally(TestNG.java:842) at org.testng.TestNG.run(TestNG.java:751) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:141) at org.apache.maven.surefire.Surefire.run(Surefire.java:180) 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:597) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:26) ... 23 more Caused by: java.lang.NoSuchFieldException: cipherService at java.lang.Class.getDeclaredField(Class.java:1882) at XyzTest.<init>(XyzTest.java:91) ... 28 more [ERROR] There are test failures.
    via by kutzi,
  • PIG Job fails when using ISOHoursBetween() UDF
    via Stack Overflow by ajay
    ,
  • 1.0.2 released
    via by Derek Chen-Becker,
  • Announcing 1.0.1!
    via by Derek Chen-Becker,
    • org.testng.TestNGException: Cannot instantiate class XyzTest at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:35) at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:330) at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:62) at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:81) at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:114) at org.testng.TestRunner.initMethods(TestRunner.java:289) at org.testng.TestRunner.init(TestRunner.java:235) at org.testng.TestRunner.init(TestRunner.java:197) at org.testng.TestRunner.<init>(TestRunner.java:141) at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:488) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:250) at org.testng.SuiteRunner.run(SuiteRunner.java:204) at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:877) at org.testng.TestNG.runSuitesLocally(TestNG.java:842) at org.testng.TestNG.run(TestNG.java:751) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:141) at org.apache.maven.surefire.Surefire.run(Surefire.java:180) 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:597) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:26) ... 23 more Caused by: java.lang.NoSuchFieldException: cipherService at java.lang.Class.getDeclaredField(Class.java:1882) at XyzTest.<init>(XyzTest.java:91) ... 28 more

    Users with the same issue

    Unknown visitor1 times, last one,
    Hiren Amaliyar
    27 times, last one,
    jokester
    1 times, last one,
    Unknown visitor1 times, last one,
    andreeaa marin
    1 times, last one,
    57 more bugmates