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
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