When I try to use okhttp
or javax.ws.rs.client.Client
the following error occur
java.lang.NoSuchMethodError: sun.security.
EDIT: since this is the "correct answer" and Java 1.8.0-151 will potentialy lack security patches. I can't recommend to downgrade to a such an old Java version.
Please take a look at Payara project or new releases of Glassfish.
--
Try to downgrade the Java version to Java 1.8.0-151. It should work.
There's an issue in glassfish 5 with Java 8 161, there's an issue created, but no changes in nightly builds regarding the issue, I checked yesterday (19th march).