-2

I'm migrating an old Java(Maven) project to Java 11. I've changed the pom.xml to support Java 11 (maven compiler plugin with <release>11<release>) and executed mvn clean compile to see whether the code compiles.. but it fails on a line which refers ssl provider from com.sun.net package

java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider())

The compilation error message is as follows

[ERROR] /D:/Workspace/sampler/src/com/sampler/test/cloudtest/CloudTest.java:[32,70] package com.sun.net.ssl.internal.ssl is not visible (package com.sun.net.ssl.internal.ssl is declared in module java.base, which does not export it)

Please help me to resolve this by providing proper ssl provider in Java11.

Master Po
  • 1,497
  • 1
  • 23
  • 42

1 Answers1

0

This was removed as a part of this bug https://bugs.openjdk.java.net/browse/JDK-8218932:

Clean up the code and remove the internal package com.sun.net.ssl.

Note that an application may still use the name "com.sun.net.ssl.internal.ssl.Provider" as the SunJSSE provider name. For compatibility, the name is still supported in the JDK. The actual implementation refers to the sun.security.ssl.SunJSSE class.

With this update, the SunJSSE provider can be specified with one of the following names:

  1. SunJSSE
  2. com.sun.net.ssl.internal.ssl.Provider

Both "SunJSSE" and "com.sun.net.ssl.internal.ssl.Provider" are existing names.

Community
  • 1
  • 1
backdoor
  • 891
  • 1
  • 6
  • 18
  • @user207421 So I can safely remove that line of code. right? Also I see setting system property as follows `System.setProperty ("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");` Is this really necessary? Can I remove that too? – Master Po May 12 '20 at 06:32
  • 2
    @MasterPo None of it has been necessary since JSSE was integrated into Java 1.4. – user207421 May 12 '20 at 09:49
  • Sorry to trouble you again. @user207421 .I'm bit confused since its something related to security. but I just want to confirm that I can remove those two lines completely and don't need to use anything from javax.net.ssl package for migrating the project to Java 11. Can you please confirm this? – Master Po May 12 '20 at 10:05
  • 2
    @MasterPo ***None of it has been necessary since JSSE was integrated into Java 1.4.*** How many times do you have to be told the same thing? And what's wrong with trying it? – user207421 May 12 '20 at 10:09