简体   繁体   English

404错误并安装Ansible Java JDK

[英]404 error installing Java JDK with ansible

I'm trying to install Java using ansible and I've seen someone have the same problem on Reddit before here . 我正在尝试使用ansible安装Java,并且在之前我已经看到有人在Reddit上遇到相同的问题。 This is the yaml file for ansible 这是用于ansible的yaml文件

    - name: download java
      get_url:
        url: "http://download.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jre-10.0.2_linux-x64_bin.rpm"
        dest: ~/
        headers: 
          Cookie: oraclelicense=accept-securebackup-cookie

I'm trying to run this (with a different link) and I keep getting a HTTP Error 404: Not Found . 我正在尝试运行此链接(使用其他链接),并且不断收到HTTP Error 404: Not Found It's the same result even if I use the same link too. 即使我也使用相同的链接,结果也是一样。

Any assistance will be appreciated. 任何帮助将不胜感激。 Thanks 谢谢

Edit, I'm trying it directly in the terminal with wget . 编辑,我正在使用wget直接在终端中尝试。 I ran wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/11+28/55eed80b163941c8885ad9298e6d786a/jdk-11_linux-x64_bin.tar.gz and the output is 我运行了wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/11+28/55eed80b163941c8885ad9298e6d786a/jdk-11_linux-x64_bin.tar.gz ,输出为

$ wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/11+28/55eed80b163941c8885ad9298e6d786a/jdk-11_linux-x64_bin.tar.gz
--2019-01-23 18:38:29--  http://download.oracle.com/otn-pub/java/jdk/11+28/55eed80b163941c8885ad9298e6d786a/jdk-11_linux-x64_bin.tar.gz
Resolving download.oracle.com (download.oracle.com)... 184.29.106.250
Connecting to download.oracle.com (download.oracle.com)|184.29.106.250|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/11+28/55eed80b163941c8885ad9298e6d786a/jdk-11_linux-x64_bin.tar.gz [following]
--2019-01-23 18:38:29--  https://edelivery.oracle.com/otn-pub/java/jdk/11+28/55eed80b163941c8885ad9298e6d786a/jdk-11_linux-x64_bin.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.56.112.136
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.56.112.136|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/11+28/55eed80b163941c8885ad9298e6d786a/jdk-11_linux-x64_bin.tar.gz?AuthParam=1548297629_d1111e625149847f66878eb0ddd67c86 [following]
--2019-01-23 18:38:29--  http://download.oracle.com/otn-pub/java/jdk/11+28/55eed80b163941c8885ad9298e6d786a/jdk-11_linux-x64_bin.tar.gz?AuthParam=1548297629_d1111e625149847f66878eb0ddd67c86
Connecting to download.oracle.com (download.oracle.com)|184.29.106.250|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://download.oracle.com/otn-pub/java/jdk/11+28/55eed80b163941c8885ad9298e6d786a/jdk-11_linux-x64_bin.tar.gz?AuthParam=1548297629_d1111e625149847f66878eb0ddd67c86 [following]
--2019-01-23 18:38:29--  https://download.oracle.com/otn-pub/java/jdk/11+28/55eed80b163941c8885ad9298e6d786a/jdk-11_linux-x64_bin.tar.gz?AuthParam=1548297629_d1111e625149847f66878eb0ddd67c86
Connecting to download.oracle.com (download.oracle.com)|184.29.106.250|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-01-23 18:38:30 ERROR 404: Not Found.

Scripted download of Java JDKs and JREs from Oracle's main download sites has always been somewhat problematic. 从Oracle的主要下载站点以脚本方式下载Java JDK和JRE一直存在一些问题。 The problem is twofold: 问题是双重的:

  1. Versions disappear from the main download site once they go EOL. 一旦停产,版本将从主下载站点中消失。 (And with Oracle's new release cadence, this happens pretty quickly for non-LTS versions ... like Java 10.) (并且随着Oracle的新发行节奏,对于非LTS版本……例如Java 10,这种情况很快发生。)

  2. Oracle want you to do the "click through agreement" thing, and they occasionally change the way it is implemented. Oracle希望您执行“点击达成协议”的事情,他们偶尔会更改其实现方式。 This tends to break scripts (Ansible, etc) that people use to automate deployment. 这往往会破坏人们用来自动化部署的脚本(Ansible等)。

Possible solutions: 可能的解决方案:

  1. Manually download a copy of the Oracle Java release to your own infrastructure, and change your deployment scripts to deploy from there rather than the Oracle site. 手动将Oracle Java版本的副本下载到您自己的基础结构中,并更改部署脚本以从那里而不是Oracle站点进行部署。

  2. Use OpenJDK ... which gives you more options for obtaining the deployables. 使用OpenJDK ...为您提供了更多获取可部署内容的选项。

  3. Switch to Java 11. Java 10 is (already) EOL. 切换到Java11。Java10已经(已经)停产。

  4. If the new release cadence is troublesome, restrict yourself to LTS versions; 如果新的发行节奏很麻烦,请限制在LTS版本; ie Java 8, Java 11, Java 14, ... 即Java 8,Java 11,Java 14,...

It's been my experience that unless I own the server and am doing something funky with it, 404 codes usually really are because that url doesn't exist. 根据我的经验,除非我拥有服务器并对其进行时髦处理,否则404代码通常确实是因为该URL不存在。 Usually, in the case of wget, I've mistyped something. 通常,对于wget,我打错了一些东西。

As far as I can tell, this case is no different. 据我所知,这种情况没有什么不同。 Copying your link into my browser directly yields this page: 404 error from oracle.com 将您的链接直接复制到我的浏览器中会显示以下页面: oracle.com 404错误

What is the correct link? 正确的链接是什么? I unfortunately couldn't tell you. 不幸的是我无法告诉你。

The way I see it you have 2 options: 我的看法有两种选择:

1) Verify the link is correct and that you've typed it correctly, or 2) Go to Oracle's site in a browser and try to download the version of Java you want/need. 1)确认链接正确并且您已正确键入它,或者2)在浏览器中转到Oracle的站点,然后尝试下载您想要/需要的Java版本。

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM