why am I getting HttpsURLConnectionOldImpl with java.protocol.handler.pkgs set to org.apache.catalina.webresources?

Viewed 27

My Tomcat 9 + Java 11 application has the java.protocol.handler.pkgs property set to org.apache.catalina.webresources.

A previous developer has put the following line:

HttpsURLConnection con = (HttpsURLConnection) new URL(protocol + hostname + path).openConnection();

and this results in the following error:

class com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl cannot be cast to class javax.net.ssl.HttpsURLConnection.

I've looked at previous questions around this error but they seem to revolve around some other value for java.protocol.handler.pkgs.

I have checked the values being used to build the URL; protocol is definitely set to "https://", and hostname and path are set to reasonable values.

  1. What do I need to reconfigure to fix this?
  2. Why am I getting that OldImpl class invoked in the first place?
0 Answers
Related