Skip to main content
Question

Unable to download file but could see the folder items

  • May 22, 2025
  • 2 replies
  • 39 views

Forum|alt.badge.img

Hi,

I have a strange issue. While downloading the file I am getting below error. Although before downloading the file I am also fetching all the file names from the folder by giving the folder id and able to see all the file names correctly which suggests that my application is able to connect to box api. Does the BoxFolder(boxConnection, folderID); and boxFile.download(stream); uses different ports?

 

Also this codes is working perfectly fine on my local machine but gives below error when I migrate the code to cloud.

 

I have removed few exception lines as it contains project specific code.

 

com.box.sdk.BoxAPIException: Couldn't connect to the Box API due to a network error.
INFO | jvm 1 | main | 2019/08/08 11:26:32.626 | at com.box.sdk.BoxAPIRequest.trySend(BoxAPIRequest.java:551)
INFO | jvm 1 | main | 2019/08/08 11:26:32.626 | at com.box.sdk.BoxAPIRequest.handleRedirect(BoxAPIRequest.java:615)
INFO | jvm 1 | main | 2019/08/08 11:26:32.626 | at com.box.sdk.BoxAPIRequest.trySend(BoxAPIRequest.java:571)
INFO | jvm 1 | main | 2019/08/08 11:26:32.627 | at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:354)
INFO | jvm 1 | main | 2019/08/08 11:26:32.627 | at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:329)
INFO | jvm 1 | main | 2019/08/08 11:26:32.627 | at com.box.sdk.BoxFile.download(BoxFile.java:295)
INFO | jvm 1 | main | 2019/08/08 11:26:32.627 | at com.box.sdk.BoxFile.download(BoxFile.java:283)

------------

Caused by: java.net.ConnectException: Connection timed out (Connection timed out) (local port 38216 to address 0.0.0.0, remote port 443 to address 107.152.27.200)
INFO | jvm 1 | main | 2019/08/08 11:26:32.727 | at java.net.PlainSocketImpl.socketConnect(Native Method)
INFO | jvm 1 | main | 2019/08/08 11:26:32.727 | at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
INFO | jvm 1 | main | 2019/08/08 11:26:32.727 | at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
INFO | jvm 1 | main | 2019/08/08 11:26:32.727 | at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
INFO | jvm 1 | main | 2019/08/08 11:26:32.727 | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
INFO | jvm 1 | main | 2019/08/08 11:26:32.727 | at java.net.Socket.connect(Socket.java:857)
INFO | jvm 1 | main | 2019/08/08 11:26:32.727 | at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)

2 replies

Forum|alt.badge.img

Issue was because the download url is different from api url.

Working fine after whitelisting 'dl.boxcloud.com'


Forum|alt.badge.img

Hi !

 

Just wanted to thank you for coming back and letting the Box Community know that you identified and resolved the issue! Doing so has the potential to clarify the situation for a lot of other community members who might be facing the same problem.

 

Thank you again for posting and for your time in the community!

Emma

Box Community Management Intern