专栏首页along的开发之旅gradle java.net.SocketException: Unexpected end of file from server
原创

gradle java.net.SocketException: Unexpected end of file from server

./gradlew build --stacktrace --debug
Downloading https://services.gradle.org/distributions/gradle-4.10.1-all.zip

Exception in thread "main" java.lang.RuntimeException: java.net.SocketException: Unexpected end of file from server
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78)
        at org.gradle.wrapper.Install.createDist(Install.java:47)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.net.SocketException: Unexpected end of file from server
        at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:851)
        at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
        at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:2055)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:183)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
        at org.gradle.wrapper.Download.downloadInternal(Download.java:59)
        at org.gradle.wrapper.Download.download(Download.java:45)
        at org.gradle.wrapper.Install$1.call(Install.java:60)
        at org.gradle.wrapper.Install$1.call(Install.java:47)
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
        ... 3 more

很奇怪,url正确,用chrome也能下载。网络看着也ok。

curl看下:

curl -v  https://services.gradle.org/distributions/gradle-4.10.1-all.zip 
*   Trying 104.18.190.9...
* TCP_NODELAY set
* Connected to services.gradle.org (104.18.190.9) port 443 (#0)

> GET /distributions/gradle-4.10.1-all.zip HTTP/1.1
> Host: services.gradle.org
> User-Agent: curl/7.64.1
> Accept: */*
> 
< HTTP/1.1 301 Moved Permanently
< Date: Wed, 16 Dec 2020 09:57:07 GMT
< Transfer-Encoding: chunked
< Connection: keep-alive
< Cache-Control: max-age=3600
< Expires: Wed, 16 Dec 2020 10:57:07 GMT
< Location: https://downloads.gradle-dn.com/distributions/gradle-4.10.1-all.zip
< cf-request-id: 070c9478c50000258d9ea59000000001
< Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
< Server: cloudflare
< CF-RAY: 602789d46b3d258d-HKG
< 
* Connection #0 to host services.gradle.org left intact
* Closing connection 0

可以看到url 301了,指向的新url是 “https://downloads.gradle-dn.com/distributions/gradle-4.10.1-all.zip”,用这个替换gradle-wrapper.properties中的地址,再次重试,完整下载。

原创声明,本文系作者授权云+社区发表,未经许可,不得转载。

如有侵权,请联系 yunjia_community@tencent.com 删除。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • JAVA实现微信退款报错unexpected end of file from server

    前几天做了微信扫码支付,同事说把退款接口也做了吧,然后就根据申请退款文档,把支付的方法拿过来用了,结果抛出了这样一个问题 unexpected end of f...

    小柒2012
  • Linux使用SFTP登陆时报错:Received unexpected end-of-file from SFTP server

    Linux系统使用SFTP登陆服务器是报错Received unexpected end-of-file from SFTP server。

    用户5640963
  • 一个初学者的SAP Cloud Platform学习笔记

    956我为什么没办法publish 到cloud 上去? 1004可能我有个工具没装。新Eclipse还是需要配proxy Possible hint: h...

    Jerry Wang
  • Python:line xx: syntax error: unexpected end of file

    经过查阅发现这种情况可能是两种原因导致的, 一:脚本格式问题,在 LinuxLinuxLinux 环境下,应该使用 unixunixunix 格式,而不是 d...

    f_zyj
  • ReactNative报错记录以及原因分析 ReactNative报错记录

    如果在android studio启动的时候发现无法访问加载js脚本文件,注意用命令 adb shell input keyevent 82 调出手机调式菜单,...

    聚优云惠
  • "CMake Error: CMake was unable to find a build program corresponding Ninja"

    前两天, 没修改什么, 打开Android Studio编so, 忽然就不成功了.

    望天
  • 【Flutter 专题】77 图解历史 Android Native 项目接入 Flutter Module

    随着 Flutter 的逐渐发展与完善,与 Native 结合使用的场景越来越多;和尚今天尝试将一个历史的 Android Native 项目接入 ...

    阿策小和尚
  • android充当server服务器

        在android上跑起来一个web服务器,可供电脑和手机通过http访问。这个需求并不常见,网上资料也不多,找了一会发现了一个不错的框架。github链...

    天涯泪小武
  • file /usr/share/mysql/charsets/README from install of MySQL-server-5.1.73-1.glibc23.i386 conflicts w

    1:也许之前的机器安装过Mysql,但是自己不知道,账号密码也忘记了,又执行安装操作,导致Mysql不兼容问题。Linux上安装MySQL时出现不兼容的解决办法...

    别先生

扫码关注云+社区

领取腾讯云代金券