org.testng.TestNGException: Cannot instantiate class XyzTest

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

,

Thrown to indicate that a specified field does not exist. make sure "strongClassCache" exists and is accessible (not private).

Solutions on the web

via Jenkins JIRA by kutzi, 1 year ago
Cannot instantiate class XyzTest
via Jenkins JIRA by kutzi, 1 year ago
Cannot instantiate class XyzTest
via Stack Overflow by Arjunesh
, 2 weeks ago
Cannot instantiate class executionEngine.DriverScriptTest
via Software Quality Assurance & Testing by ashok
, 1 month ago
via Stack Overflow by Nilam K
, 7 months ago
Cannot instantiate class com.test.java.LoginTest
org.testng.TestNGException: Cannot instantiate class XyzTest
at undefined.XyzTest.(XyzTest.java:91)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:26)
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.(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.(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 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)

Users with the same issue

Samebug visitor profile picture
Unknown user
Once, 1 year ago
Once, 1 day ago
34 times, 1 month ago
13 times, 2 months ago
3 times, 3 months ago

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.