NoSuchMethodError thrown using testng 6.3


(Chris Cizek) #1

The method org.testng.TestNG.setAnnotations is no longer in testng 6.3. I am using gradle version 0.9.2, but I see that method is still called in the latest gradle source. Here is the exception

  org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not complete execution for test process 'Gradle Worker 1'.





 at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:60)





 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.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)





 at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)





 at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)





 at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:75)





 at $Proxy4.stop(Unknown Source)





 at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:91)





 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.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)





 at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)





 at org.gradle.messaging.remote.internal.MethodInvocationUnmarshallingDispatch.dispatch(MethodInvocationUnmarshallingDispatch.java:48)





 at org.gradle.messaging.dispatch.DiscardOnFailureDispatch.dispatch(DiscardOnFailureDispatch.java:31)





 at org.gradle.messaging.dispatch.AsyncDispatch.dispatchMessages(AsyncDispatch.java:129)





 at org.gradle.messaging.dispatch.AsyncDispatch.access$000(AsyncDispatch.java:33)





 at org.gradle.messaging.dispatch.AsyncDispatch$1.run(AsyncDispatch.java:69)





 at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:63)





 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)





 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)





 at java.lang.Thread.run(Thread.java:595)  Caused by: java.lang.NoSuchMethodError: org.testng.TestNG.setAnnotations(Ljava/lang/String;)V





 at org.gradle.api.internal.tasks.testing.testng.TestNGTestClassProcessor.stop(TestNGTestClassProcessor.java:71)





 at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:58)





 ... 25 more  

(Peter Niederwieser) #2

Chris informed me that the problem only occurs with TestNG 6.3 but not with 6.2. For the time being he can work around by using 6.2. We already have an issue for this, namely GRADLE-1860.