I am building a Java Selenium standalone application using Java11 in Eclipse 2018-12 but my builds fail:
java.lang.module.FindException: Unable to der
see here https://github.com/SeleniumHQ/selenium/wiki/Building-WebDriver
The Java JDK 8 (note that versions 9 & 10 are not currently supported for building Selenium). Download it from Oracle's site if it's not already on your computer.
This is due to a mistake in the .jar file. It contains a META-INF/services/org.eclipse.jetty.http.HttpFieldPreEncoder
entry, which, according to the jar service provider interface specification, must contain the name of a class in the same .jar file which implements the interface org.eclipse.jetty.http.HttpFieldPreEncoder
.
But, as the exception states, that service descriptor file contains org.eclipse.jetty.http.Http1FieldPreEncoder
, a class which does not exist in the .jar file.
There is, however, a org.seleniumhq.jetty9.http.Http1FieldPreEncoder
class in the .jar.
The easiest way to fix this is:
META-INF/services/org.eclipse.jetty.http.HttpFieldPreEncoder
so it contains the single line org.seleniumhq.jetty9.http.Http1FieldPreEncoder
.If you’re not in Windows, you can do it on the command line:
mkdir -p META-INF/services
echo org.seleniumhq.jetty9.http.Http1FieldPreEncoder > META-INF/services/org.eclipse.jetty.http.HttpFieldPreEncoder
zip -u -m selenium-server-standalone-3.141.59.jar META-INF/services/org.eclipse.jetty.http.HttpFieldPreEncoder
rm -r META-INF
For me, it was that i only had to move the selenium.jar in my build path in libraries from modulepath to classpath. hope it helps.
Encountered the same problem, defining all the jars in the classpath will serve the purpose.