0

I'm new to this form,

I was getting an OutOfMemoryError while trying to upload a large file to dropbox via java dropbox sdk.

Here is my scenario :

Server A contains a file (>1GB) --> Server B opens a stream and passes that stream to dropbox api in java

Here is my code :

DbxRequestConfig config = new DbxRequestConfig("dropbox/java-tutorial","en_US");
    DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN);
    try {
        URL url = new URL(url_d);           
        // Upload Files to Dropbox
        String fileName = url_d.substring( url_d.lastIndexOf('/')+1, url_d.length() );
        DbxFiles.FileMetadata metadata = client.files.uploadBuilder("/"+fileName).run(url.openStream());

    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (UploadException e) {
        e.printStackTrace();
    } catch (DbxException e) {
        e.printStackTrace();
    }

Can anyone give me a solution. Thank you.

3
  • Increse JVM max mem size and try again. Commented Jan 20, 2016 at 12:20
  • I do not have the access to change the mem size,because i had deployed it on Openshift free tire which gives ~256mb ram. Commented Jan 20, 2016 at 13:22
  • You better paster complete stacktrace. And more over where are references to that A file in your code, only some upload builder (but you want to DL it? or transfer it between servers?). Probably related, not seeing it whatsoever. Commented Jan 20, 2016 at 13:54

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.