I am getting ORA-29532: Java call terminated by uncaught Java exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure exception when I try to run java class from PL SQL. Some URL works fine, but most get this error.When I run this class from IntelliJ every kind of URL works fine. Can anyone please direct me where the problem could be?
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "ConnectHttps" AS import java.io.*;import java.net.URL;import javax.net.ssl.HttpsURLConnection;public class ConnectHttps{ public static String GetHttps() throws IOException { URL u = new URL("https://api.blockchain.com/v3/exchange/l2/BTC-USD"); // - doesnt work //URL u = new URL("https://official-joke-api.appspot.com/random_joke"); // - work HttpsURLConnection http = (HttpsURLConnection) u.openConnection(); http.setAllowUserInteraction(true); http.setRequestMethod("GET"); http.connect(); InputStream is = http.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuilder stringBuilder = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { stringBuilder.append(line +"\n"); } return stringBuilder.toString(); }};
/
> create or replace function test return varchar2> AS LANGUAGE JAVA> NAME 'ConnectHttps.GetHttps() return java.lang.String';
/
> exec dbms_output.put_line(test);