question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:

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:

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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:17 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
asolntsevcommented, Oct 14, 2021

@bonigarcia @zhuyuemings I managed to reproduce the issue once, here is my stacktrace:

java.lang.NoClassDefFoundError: Could not initialize class org.openqa.selenium.net.HostIdentifier
	at integration.CollectionReloadingTest.reloadsCollectionOnEveryCall(CollectionReloadingTest.java:28)

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.

1reaction
diemolcommented, Nov 19, 2021

If things go well, we will release next week. You should join us in our Slack channel to stay even more up to date!

Read more comments on GitHub >

github_iconTop Results From Across the Web

What causes java.lang.NoClassDefFoundError: org/openqa ...
I create a new project use Gradle other than Maven with selenium 4.0.0 and it works fine. so I check the incorrect libraries...
Read more >
Eclipse java lang NoClassDefFoundError - Selenium - Edureka
I have installed java and eclipse, and downloaded the JARS and placed them in the right directory as it should be. Below is...
Read more >
Extent Reports in Selenium with TestNG
Right-click to TestNG.xml file and run the tests here by clicking the green Run text. After the test is finished, you will see...
Read more >
Exception in thread "main" java.lang.NoClassDefFoundError
In Eclipse,. Expand your project; Right click on Referenced Libraries. Point to Build Path; Select Configure Build Path; In the dialog box that...
Read more >
Spring Boot Reference Guide
Spring Boot is compatible with Gradle 2 (2.9 or later). ... If you are on a Mac and using Homebrew, all you need...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found