NoClassDefFoundError after bumping to selenium-java 4.0.0 in Mac OS
See original GitHub issue🐛 Bug Report
I have a couple of repositories using Selenium 4:
- https://github.com/bonigarcia/selenium-webdriver-java/
- https://github.com/bonigarcia/webdrivermanager/
I use GitHub Actions to run the tests in these repositories, using three different virtual environments:
ubuntu-latest
(Ubuntu 20.04).windows-latest
(Windows Server 2019).macos-latest
(macOS 10.15).
After bumping to selenium-java 4.0.0-rc-1, several tests of the Mac OS workflow are failing due to NoClassDefFoundError
, such as:
java.lang.NoClassDefFoundError: Could not initialize class org.openqa.selenium.WebDriverException
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:571)
… or:
java.lang.NoClassDefFoundError: Could not initialize class org.openqa.selenium.net.HostIdentifier
at io.github.bonigarcia.wdm.test.create.ChromeRemoteTest.setupClass(ChromeRemoteTest.java:41)
To Reproduce/Test script
I don’t have a Mac OS machine to test it, but the error seems consistent in Mac OS (at least on GitHub Actions).
The test that fails are the following:
- 10 tests in selenium-webdriver-java. For instance: FluentWaitJUnit4Test (see the complete workflow traces and the workflow setup).
- 1 test in WebDriverManager: ChromeRemoteTest (see workflow traces and the workflow setup).
Environment
OS: macOS 10.15 (on GitHub Actions)
Browser: Chrome
Browser version: 93
Browser Driver version: chromedriver 93.0.4577.15
Language Bindings version: selenium-java 4.0.0-rc-1
Selenium Grid version (if applicable): 4.0.0-rc-1 (the dependency org.seleniumhq.selenium:selenium-grid
is also used in WebDriverManager, but not in selenium-webdriver-java)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:17 (14 by maintainers)
Top GitHub Comments
@bonigarcia @zhuyuemings I managed to reproduce the issue once, here is my stacktrace:
Some error happens in the static initialisation block of class
HostIdentifier
. Unfortunately, I don’t see the exact error, and cannot reproduce it anymore. But it’s clear how to fix it: just add more try/catch blocks there.P.S. As I already suggested in https://github.com/SeleniumHQ/selenium/issues/3048, the host resolving is not really needed and should be removed from Selenium code.
If things go well, we will release next week. You should join us in our Slack channel to stay even more up to date!