Nikhil Panchal
Nikhil Panchal

Reputation: 1

I am getting this error while running the testng file in eclipse

Java Code :

package java_package;

import org.testng.annotations.Test;

public class Testng1 {

@Test 
public void log() {
    System.out.println("Hello");
}

}

getting this error: [RemoteTestNG] detected TestNG version 7.8.0 Exception in thread "main" 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.TestNG.(TestNG.java:113) at org.testng.remote.support.RemoteTestNGFactory7_8.createRemoteTestNG(RemoteTestNGFactory7_8.java:16) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:67) Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ... 6 more

Tried to install using Eclipse Marketplace through eclipse and also tried to update the eclipse version

Upvotes: -2

Views: 3000

Answers (1)

Vaishali
Vaishali

Reputation: 31

Add the following JARs to the build path or lib folder of the project:

https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.2 =slf4j-api-1.7.2.jar

https://mvnrepository.com/artifact/org.slf4j/slf4j-jdk14/1.7.2 =slf4j-jdk14-1.7.2.jar

Upvotes: 3

Related Questions