Java Webstart 无法脱机工作 (NoRouteToHostException/UnknownHostException) [英] Java Webstart not working offline (NoRouteToHostException/UnknownHostException)

查看:24
本文介绍了Java Webstart 无法脱机工作 (NoRouteToHostException/UnknownHostException)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想配置我的 webstart 应用程序/jnlp,以便如果没有可用的互联网连接,它将从缓存启动.尽管如此,当我断开互联网连接时,我总是收到 NoRouteToHostException 或 UnknownHostException 异常,尽管有以下配置.

I want to configure my webstart app/jnlp so that if no internet connection is available, it would start from cache. Nevertheless, when I disconnect from the internet, I always get a NoRouteToHostException or UnknownHostException exception, despite the configuration below.

我认为我已经正确设置了离线允许和更新标签/属性;我找不到 webstart 仍在尝试查找主机的原因.当我连接时,我确实从上次开始缓存了该应用程序.

I've set the offline-allowed and update tags/attributes properly I think; I cannot find the reason why webstart is still trying to lookup the host. I definitely do have the app cached from my previous start when I was connected.

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="6.0+" codebase="http://cms.mydomain.com/sync/" href="myAppSync.jnlp">

<information>
    <title>My App Sync</title>
    <vendor>My Company</vendor>
    <homepage href="http://www.myapp.com/"/>
    <description>Sync application for My App</description>
    <icon href="ATTico.png"/>        

    <!-- allow app to run without Internet access -->
    <offline-allowed/>

    <shortcut online="true">          
      <desktop/>
      <!-- create menu item for this app under the major heading 'My App' -->
      <menu submenu="My App"/>
    </shortcut>

</information>

<security>
    <all-permissions/>
</security>

<update check="timeout" policy="always" />

<resources>
    <java version="1.6*" href="http://java.sun.com/products/autodl/j2se"/>
    <jar href="lib/myAppSync.jar" />
    <jar href="lib/apache-mime4j-0.6.jar" />
    <jar href="lib/commons-logging-1.1.1.jar" />
    <jar href="lib/commons-codec-1.3.jar" />
    <jar href="lib/httpclient-4.0.1.jar" />
    <jar href="lib/httpcore-4.0.1.jar" />
    <jar href="lib/httpmime-4.0.1.jar" />
    <jar href="lib/swingx-1.6.jar" />
    <jar href="lib/swingx-beaninfo-1.6.jar" />        
</resources>

<application-desc main-class="com.myapp.sync.forms.Main"/>

</jnlp>

错误日志:

java.net.NoRouteToHostException: No route to host: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX(Unknown Source)
at com.sun.deploy.net.DownloadEngine.isUpdateAvailable(Unknown Source)
at com.sun.deploy.net.DownloadEngine.isUpdateAvailable(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.downloadJarFiles(Unknown Source)
at com.sun.javaws.LaunchDownload.downloadEagerorAll(Unknown Source)
at com.sun.javaws.Launcher.downloadResources(Unknown Source)
at com.sun.javaws.Launcher.prepareLaunchFile(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)



java.net.UnknownHostException: cms.mydomain.com
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX(Unknown Source)
at com.sun.deploy.net.DownloadEngine.isUpdateAvailable(Unknown Source)
at com.sun.deploy.net.DownloadEngine.isUpdateAvailable(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.downloadJarFiles(Unknown Source)
at com.sun.javaws.LaunchDownload.downloadEagerorAll(Unknown Source)
at com.sun.javaws.Launcher.downloadResources(Unknown Source)
at com.sun.javaws.Launcher.prepareLaunchFile(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

推荐答案

我找到了一个解决方案,通过从命令行使用 -offline 参数调用 javaws,但我觉得奇怪的是这是必要的,想知道为什么系统不能自动检测我处于离线状态,因此检查超时并从缓存中启动应用程序,如我的 jnlp 中所定义.

I've found a solution by calling javaws from command line with the -offline parameter, but I find that weird that this is necessary, wondering why the system cannot automatically detect that I'm offline and therefore timeout on the check and start the app from cache, as defined in my jnlp.

javaws -offline myApp.jnlp

这篇关于Java Webstart 无法脱机工作 (NoRouteToHostException/UnknownHostException)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆