Java Web 启动 - 无法加载资源
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2643893/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java web start - Unable to load resource
提问by CD..
I've got a jar that loads great with java web start when I browse through the IP address of the server. Once I try the server nameinstead I get the following exception:
我有一个 jar,当我浏览服务器的 IP 地址时,它可以很好地加载 java web start。一旦我尝试使用服务器名称,我就会收到以下异常:
com.sun.deploy.net.FailedDownloadException: Unable to load resource: at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source) at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source) at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source) at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source) at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source) at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source) at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
The wrapped exception:
包装的异常:
java.io.FileNotFoundException: at sun.reflect.GeneratedConstructorAccessor2.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source) at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source) at com.sun.deploy.net.BasicHttpRequest.doGetRequest(Unknown Source) at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source) at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source) at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source) at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source) at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source) at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source) at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.io.FileNotFoundException: at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at java.net.HttpURLConnection.getResponseCode(Unknown Source) ... 15 more
JNLP:
JNLP:
<?xml version="1.0" encoding="utf-8"?>
<jnlp
spec="1.0+"
codebase="http://servername/Site/Views/.."
href="">
<information>
<title>title</title>
<vendor>vendor</vendor>
<description>description</description>
<description kind="short">short</description>
<icon href="../../icon.gif" />
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.5+" java-vm-args="-Xmx1000M -Xms150M" initial-heap-size="150M" max-heap-size="1000M" />
<j2se version="1.4.2+" href="http://java.sun.com/products/autodl/j2se" java-vm-args="-Xmx1000M -Xms150M" initial-heap-size="150M" max-heap-size="1000M" />
<jar href="/file.jar"/>
</resources>
<application-desc main-class="com....">
<argument>CD6B172DEC34924D83EA64A61A6550BE1271325929392</argument>
<argument>http://servername/file.asp</argument>
<argument>/Site</argument>
</application-desc>
</jnlp>
Any idea what should I look for?
知道我应该寻找什么吗?
采纳答案by CD..
I've changed the java proxy settings to direct connection - and it works.
我已将 java 代理设置更改为直接连接 - 它可以工作。
回答by James B
I'm not sure exactly what the problem is, but I have looked at one of my jnlp files and I have put in the full path to each of my jar files. (I have a velocity template that generates the app.jnlp file which places it in all the correct places when my maven build runs)
我不确定到底是什么问题,但是我查看了我的一个 jnlp 文件,并且已经输入了每个 jar 文件的完整路径。(我有一个速度模板,它生成 app.jnlp 文件,当我的 Maven 构建运行时,它将它放在所有正确的位置)
One thing I have seen happen is that the jnlp file is re-downloaded by the by the webstart runtime, and it uses the href attribute (which is left blank in your jnlp file) to re-download the file. I would start there, and try adding the full path into the jnlp files too...I've found webstart to be a fickle mistress!
我看到的一件事是 jnlp 文件由 webstart 运行时重新下载,并且它使用 href 属性(在 jnlp 文件中留空)重新下载文件。我会从那里开始,并尝试将完整路径添加到 jnlp 文件中……我发现 webstart 是一个善变的情妇!
回答by Vijay Sharma
Include your IP address in your host file (C:\Windows\System32\drivers\etc\host) for the respective server:
在相应服务器的主机文件 (C:\Windows\System32\drivers\etc\host) 中包含您的 IP 地址:
Sample Entry:
示例条目:
10.100.101.102 server1.us.vijay.com Vijay's Server
10.100.101.102 server1.us.vijay.com Vijay 的服务器
回答by mowwwalker
If anyone else gets here because they're trying to set up a Jenkins slave, then you need to set the url of the host to the one it's actually using.
如果其他人因为试图设置 Jenkins 从站而来到这里,那么您需要将主机的 URL 设置为它实际使用的 URL。
On the host, go to Manage Jenkins > Configure System and edit "Jenkins URL"
在主机上,转到管理 Jenkins > 配置系统并编辑“Jenkins URL”
回答by user8996057
i got the same issue, i updated the hosts file with the server address and it worked
我遇到了同样的问题,我用服务器地址更新了主机文件,它工作正常
回答by Brent Sandstrom
changing java proxy settings to direct connection did not fix my issue.
将 java 代理设置更改为直接连接并没有解决我的问题。
What worked for me:
什么对我有用:
- Run "Configure Java" as administrator.
- Go to Advanced
- Scroll to bottom
- Under: "Advanced Security Settings" uncheck "Use SSL 2.0 compatible ClientHello format"
- Save
- 以管理员身份运行“配置 Java”。
- 进入高级
- 滚动到底部
- 在:“高级安全设置”下取消选中“使用 SSL 2.0 兼容的 ClientHello 格式”
- 节省