-
Notifications
You must be signed in to change notification settings - Fork 165
Description
Problem Statement
please read https://github.com/cbeust/testng-eclipse/blob/master/docs/Troubleshooting.md first
When running the plugin there is the following classpath error:
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
I have version 7.5 of the plugin installed. This occurs with 2021.12 eclipse version, fresh install. It once worked , but
after the plugin has automatically upgraded to 7.5, it stopped working I don't know if it is related or not.
However When I uninstall and reinstall the plugins to 7.4.0, it does not change the error.
But eclipse is tricky when you try to uninstall and rollback to previous version. I needed to uninstall files manually, and then I managed to rollback to 7.1.1 and it worked.
Any relate message in "Error Log" view
"Windows -> Show View -> Others -> Error Log"
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.testng.log4testng.Logger.lambda$getLogger$0(Logger.java:30)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
at org.testng.log4testng.Logger.getLogger(Logger.java:30)
at org.testng.xml.LaunchSuite.(LaunchSuite.java:25)
at org.testng.eclipse.util.SuiteGenerator.createCustomizedSuite(SuiteGenerator.java:34)
at org.testng.eclipse.ui.util.ConfigurationHelper.createLaunchSuites(ConfigurationHelper.java:604)
at org.testng.eclipse.ui.util.ConfigurationHelper.getLaunchSuites(ConfigurationHelper.java:448)
at org.testng.eclipse.launch.TestNGLaunchConfigurationDelegate.createVMRunner(TestNGLaunchConfigurationDelegate.java:315)
at org.testng.eclipse.launch.TestNGLaunchConfigurationDelegate.launchTypes(TestNGLaunchConfigurationDelegate.java:156)
at org.testng.eclipse.launch.TestNGLaunchConfigurationDelegate.launch(TestNGLaunchConfigurationDelegate.java:93)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:803)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:716)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1021)
at org.eclipse.debug.internal.ui.DebugUIPlugin$2.run(DebugUIPlugin.java:1224)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory cannot be found by org.testng_7.5.0.r202201070709
at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:516)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:511)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:403)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 15 more
eclipse.buildId=4.22.0.I20211124-1800
java.version=17.0.1
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=fr_FR
Framework arguments: -product org.eclipse.epp.package.java.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product
Alternatively I can also have the following error on other projects, depending on the dependencies...
java.lang.NoClassDefFoundError: Could not initialize class org.testng.eclipse.util.ClassMethodsSuite
at org.testng.eclipse.util.SuiteGenerator.createCustomizedSuite(SuiteGenerator.java:34)
at org.testng.eclipse.ui.util.ConfigurationHelper.createLaunchSuites(ConfigurationHelper.java:604)
at org.testng.eclipse.ui.util.ConfigurationHelper.getLaunchSuites(ConfigurationHelper.java:448)
at org.testng.eclipse.launch.TestNGLaunchConfigurationDelegate.createVMRunner(TestNGLaunchConfigurationDelegate.java:315)
at org.testng.eclipse.launch.TestNGLaunchConfigurationDelegate.launchTypes(TestNGLaunchConfigurationDelegate.java:156)
at org.testng.eclipse.launch.TestNGLaunchConfigurationDelegate.launch(TestNGLaunchConfigurationDelegate.java:93)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:803)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:716)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1021)
at org.eclipse.debug.internal.ui.DebugUIPlugin$2.run(DebugUIPlugin.java:1224)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
The Dependency Management tool for your project
-
Maven
-
Gradle
-
Ant
-
Eclipse Buildpath (aka. Use "TestNG Library" for your project in Eclipse)
testImplementation ('org.testng:testng:7.5') { exclude module: 'guice' }
testImplementation group: 'com.google.inject', name: 'guice', version: '5.1.0' // force version
testImplementation 'junit:junit:4.13'
Operating System
- Windows
- Linux
- OSX