Can't open HTTPS URLs

This in Service code:

new URL("https://graph.facebook.com").openConnection();

Results in:

Caused by: java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\Program%20Files\Java\jre1.8.0_73\lib\ext\amd64\sunec.dll" "read")
        at java.security.AccessControlContext.checkPermission(Unknown Source)
        at java.security.AccessController.checkPermission(Unknown Source)
        at java.lang.SecurityManager.checkPermission(Unknown Source)
        at com.backendless.coderunner.runtime.security.CodeRunnerSecurityManager.checkPermission(CodeRunnerSecurityManager.java:52)
        at java.lang.SecurityManager.checkRead(Unknown Source)
        at java.io.File.exists(Unknown Source)
        at java.io.WinNTFileSystem.canonicalize(Unknown Source)
        at java.io.File.getCanonicalPath(Unknown Source)
        at java.io.FilePermission$1.run(Unknown Source)
        at java.io.FilePermission$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.io.FilePermission.init(Unknown Source)
        at java.io.FilePermission.<init>(Unknown Source)
        at java.lang.SecurityManager.checkRead(Unknown Source)
        at java.io.File.exists(Unknown Source)
        at sun.misc.Launcher$ExtClassLoader.findLibrary(Unknown Source)
        at java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.lang.Runtime.loadLibrary0(Unknown Source)
        at java.lang.System.loadLibrary(Unknown Source)
        at sun.security.ec.SunEC$1.run(SunEC.java:60)
        at sun.security.ec.SunEC$1.run(SunEC.java:58)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.security.ec.SunEC.<clinit>(SunEC.java:58)
        ... 32 more

Do you have system environment variable “JAVA_HOME” and where it indicates?
To check this, please type in console:
echo %JAVA_HOME%

Wait - does CodeRunner run the code locally or on the server?

My JAVA_HOME points to a JDK, however jre1.8.0_73 is the java which is in my path.

The directory lib\ext\amd64 doesn’t exist in neither of the installations. And running this code in a Main class with JRE1.8.0_73 does not throw this exception.

Debug version of code runner runs locally - on your computer. Where did you get the exception you originally posted?

Sorry I forgot to mention it’s during debugging - I assumed it runs on the server.

I created a test method in my service:

 public void openUrl(String url) throws IOException {
 new URL(url).openConnection();
 }

During debugging, this throws the exception above. Deployed on the server, it does not.

This is my lib/ext:
http://support.backendless.com/public/attachments/eecc35e647adce04a8a1910d7583d045.png</img>

Running this with the same JRE does not throw an exception:

 public static void main(String[] args) throws IOException {
 new URL("[url=https://graph.facebook.com]https://graph.facebook.com").openConnection[/url]();
 }

I’m on a x64 system.

Try adding your specific policy to “security.policy” file in CodeRunner.jar.
Here’s how it can be done:

  1. Unpack CodeRunner.jar (it is just a simple zip archive) into separate folder;

  2. You will find the “security.policy” file, where you can add a custom policy. You will find the following lines at the top of the file.
    //permission java.security.AllPermission;
    Make sure to uncomment these lines.

  3. The modified file should be replaced in the archive. Make sure to recreate CodeRunner.jar with the modified file.

  4. Now it should be ready to run with the modified (and least restrictive) security policy.

worked for me!