Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.net.ProtocolException: Server redirected too many times (20)

Costanzo TartagliaFeb 15 2016 — edited Dec 10 2018

Good day to all.

I developed in Pl/sql environment to OracleForms a java source in order to copy form a url to a file system location an object ( in my case a pdf file) .

The code is:

   public static void copy_file_from_URL(int[] rcode, String[] msg, String fromURL, String toFileName) {
        try {
            URL url = new URL(fromURL);
            URLConnection connection = url.openConnection();
            InputStream stream = connection.getInputStream();
 

Whith the instruction "connection.getInputStream()", I received the following error:

java.net.ProtocolException: Server redirected too many  times (20)

        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1446).

I found on the web the solution to add as the first statement line this:

   CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL));


It works fine since JDK1.6, but however, In PLSQL I did not have the CookieHandler object because i have in PLSQL the java version " 1.4.2_14 " .

How can i do ?

Is there some code that can do the same operations of the Cookiehandler?


Thank you in advance.


Message was edited by: Costanzo Tartaglia

This post has been answered by Paulzip on Feb 15 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 14 2016
Added on Feb 15 2016
1 comment
787 views