testng-team / testng-eclipse

Eclipse plug-in for TestNG
https://testng.org
194 stars 164 forks source link

TestNG plugin 7.8.0 requires that I add slf4j to classpath #559

Closed JFK-DXML closed 10 months ago

JFK-DXML commented 1 year ago

Problem Statement

Upgrading to TestNG Eclipse plugin 7.8.0 seems to require slf4j to the Eclipse build path whereas previously it did not

Screenshot 2023-06-13 at 10 47 07

Any relate message in "Error Log" view

"Windows -> Show View -> Others -> Error Log" Nothing pertinent

The Dependency Management tool for your project

We have a strange build setup which uses the java Builder synchronized with an an build.xml to build things

Operating System

missedone commented 1 year ago

@JFK-DXML , thanks for reporting the issue, i can reproduce it on eclipse 2023-09 as well, let me see how to fix it

missedone commented 1 year ago

oh, wait, i got a different error not relate to this.

missedone commented 1 year ago

@JFK-DXML , the slf4j jar is in the testng-p2 update site https://github.com/testng-team/testng-p2-update-site/tree/main/updatesites/7.8.0.r202306071539/plugins

pls double check if it's on your installed plugin list

image
missedone commented 1 year ago

@JFK-DXML do you see any error on the "Error Log" view

271844355-8d345cfe-8398-4fe5-ab72-47de7ed52022
SantiBailors commented 1 year ago

I have the same, I had initially reported it at #533 (post) and I was rightfully pointed here so I'm reporting it here.

I am using the plugin v. 7.8.0 but I'm getting the same 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

Since I don't need this logger, I used the workaround of adding (as external jar) to the build path of the project that contains these tests the slf4j-api jar (https://www.slf4j.org/download.html), so now I just get a warning that it's using a no-op logger implementation (see https://www.slf4j.org/codes.html#noProviders for actual logging).

image

Eclipse 2023-09 (4.29.0, Build id: 20230907-1323), Windows 10 Pro.

java.specification.version=17 java.vm.vendor=Eclipse Adoptium sun.arch.data.model=64 java.vm.specification.version=17 java.runtime.version=17.0.7+7

I get no errors in the Error Log after I run the problematic test:

image

However I do get a TestNG-related error there when I do "Check for updates":

image

image

Re the plugin list mentioned above by @missedone, I do have that plugin. This is the list filtered by typing "slf":

image

This is what I have under "Available Software Sites" (list filtered by typing "testng"):

image

I did not try to manually add the update site mentioned above by @missedone because I don't want a workaround of adding an update site address specific to a given version (I prefer to keep my workaround of manually adding the slf4j-api jar (https://www.slf4j.org/download.html) to the build path as it's more likely that I will remember to remove it when this error is fixed), but if that helps I can do that and report the outcome.

JFK-DXML commented 1 year ago

@JFK-DXML , the slf4j jar is in the testng-p2 update site https://github.com/testng-team/testng-p2-update-site/tree/main/updatesites/7.8.0.r202306071539/plugins

pls double check if it's on your installed plugin list

Here is what I have, having swapped 7.4.0 for 7.8.0

Screenshot 2023-10-02 at 15 44 23
JFK-DXML commented 1 year ago

@JFK-DXML do you see any error on the "Error Log" view

Here is what I see when running the test

Screenshot 2023-10-02 at 15 57 00 Screenshot 2023-10-02 at 15 55 55
missedone commented 1 year ago

@JFK-DXML do you see any error on the "Error Log" view

Here is what I see when running the test

Screenshot 2023-10-02 at 15 57 00 Screenshot 2023-10-02 at 15 55 55

Could you share the detail of the message field in the screenshot, most important is the classpath list in the message

missedone commented 10 months ago

closing this as 7.9.0 should have solved this issue.

see https://github.com/testng-team/testng-eclipse/issues/561#issuecomment-1883393683