SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
29.75k stars 8.02k forks source link

[🐛 Bug]: Exception in thread "main" java.lang.NoClassDefFoundError: io/netty/util/Timer #14210

Open zeus200003 opened 3 days ago

zeus200003 commented 3 days ago

What happened?

After adding all the files needed and changing the working env. to JRE 22 , new problem occurred which preventing selenium from starting

How can we reproduce the issue?

package samplePackage;

import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.*;

public class WebDriverDemo {

    public static void main(String[] args) {

        System.setProperty("webdriver.chrome.driver", "C:\\Users\\peter\\OneDrive\\Desktop\\Selenium Jars & Drivers\\Drivers\\chromedriver.exe");
        WebDriver driver = new ChromeDriver() ;
        driver.navigate().to("www.google.com");

    }

}

Relevant log output

Exception in thread "main" java.lang.NoClassDefFoundError: io/netty/util/Timer
    at org.openqa.selenium.remote.http.netty.NettyClient$Factory.createClient(NettyClient.java:135)
    at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:116)
    at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:94)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.<init>(DriverCommandExecutor.java:88)
    at org.openqa.selenium.chromium.ChromiumDriverCommandExecutor.<init>(ChromiumDriverCommandExecutor.java:40)
    at org.openqa.selenium.chrome.ChromeDriver$ChromeDriverCommandExecutor.<init>(ChromeDriver.java:111)
    at org.openqa.selenium.chrome.ChromeDriver.generateExecutor(ChromeDriver.java:101)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:88)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:84)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:52)
    at samplePackage.WebDriverDemo.main(WebDriverDemo.java:11)
Caused by: java.lang.ClassNotFoundException: io.netty.util.Timer
    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:525)
    ... 11 more

Operating System

Windows 11

Selenium version

selenium-java-4.22.0

What are the browser(s) and version(s) where you see this issue?

Chrome

What are the browser driver(s) and version(s) where you see this issue?

Chrome Driver latest stable version available

Are you using Selenium Grid?

No response

github-actions[bot] commented 3 days ago

@zeus200003, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

MHabiib commented 2 days ago

hi @zeus200003 Make sure your pom.xml file specifies 22</java.version> to ensure compatibility with Java 22. Also, correct the usage of driver.get() in your Selenium script by including the full URL with the protocol e.g., driver.get("http://www.google.com");. These steps should resolve the issues you're encountering with Selenium not starting and ensure proper navigation in your WebDriver script.