Running testng.xml file throws noClassFoundError. | Selenium Forum
V
Vishwanathvba Posted on 12/01/2024

i get below error when i run the testng.xml file. tried adding external jars. even then i got this error. please help

 

Eclipse Console:

[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.<clinit>(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

 

 

 

 

 

textng.xml file

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">

<suite name="Booking Suite">

<test name="Create Booking Test">

<classes>

<class name="testcases.BookingSearch">

<methods>

<include name="searchHotel"/>

<include name="selectHotel"/>

<include name="enterGuestInfo"/>

</methods>

</class>

<class name="testcases.CustomerCommunications">

<methods>

<include name="discount"/>

<include name="makePayment"/>

</methods>

</class>

<class name="testcases.CustomerCommunications"/>

 

</classes>

</test> <!-- Test -->

</suite> <!-- Suite -->