Can't Upload Files
Hello,
I succeed to create folders with my token in Java application, and also succeed to download files, but when I try to upload files, I encontered this exception:
Exception in thread "main" com.box.sdk.BoxAPIException: Couldn't connect to the Box API due to a network error.
at com.box.sdk.BoxMultipartRequest.writeBody(BoxMultipartRequest.java:154)
at com.box.sdk.BoxAPIRequest.trySend(BoxAPIRequest.java:389)
at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:209)
at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:184)
at com.box.sdk.BoxFolder.uploadFile(BoxFolder.java:387)
at com.box.sdk.BoxFolder.uploadFile(BoxFolder.java:334)
at com.soft.test.BoxSDKSample.uploadFile(BoxSDKSample.java:120)
at com.soft.test.BoxSDKSample.listFolder(BoxSDKSample.java:150)
at com.soft.test.BoxSDKSample.listFolder(BoxSDKSample.java:147)
at com.soft.test.BoxSDKSample.main(BoxSDKSample.java:57)
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1509)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1283)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1258)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
at com.box.sdk.BoxMultipartRequest.writeBody(BoxMultipartRequest.java:126)
... 9 more
I guess that when I'm trying to upload a file, the upload URL goes to https://upload.box.com/api/2.0/files/content, it seems that I need to import a certificate, BUT I don't
know where to get it.
Can anyone give me a hand?Thanks in advance.
-
This thread has some possible solutions to the issue you described. The most common reason for this issue is something in your development environment is blocking or filtering information from your API request.
-
Thanks , I have seen the solutions provided. I'm quite curious about why I can create folders, delete folders and even download files from box, but I just can't upload a file to it. Is it something about stream? or privilege? I don't think the security software to be the reason, since I have to work with it. Can Box Team give some advice beyond the software? Thanks a lot!
Please sign in to leave a comment.
Comments
2 comments