Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JNLPFileFactory runs into NullPointerException when Server answered to GET with "301 Moved Permanently" #226

Open
FelixJongleur42 opened this issue Apr 1, 2020 · 35 comments
Assignees

Comments

@FelixJongleur42
Copy link

At one time the file was not downloadeble due to proxy misconfiguration.
After correcting the proxy settings, ran into this.
Temporary Internet File Cache (under OWS Settings) shows no files at all.

Code
https://github.com/AdoptOpenJDK/IcedTea-Web/blob/master/core/src/main/java/net/sourceforge/jnlp/JNLPFileFactory.java

    private InputStream openURL(final URL location, final VersionString version, final UpdatePolicy policy) throws IOException {
        Assert.requireNonNull(location, "location");
        Assert.requireNonNull(policy, "policy");

        try {
            final ResourceTracker tracker = new ResourceTracker(false, DownloadOptions.NONE, policy); // no prefetch
            tracker.addResource(location, version);
            final File f = tracker.getCacheFile(location);
            return new FileInputStream(f);
        } catch (IOException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new IOException(ex);
        }
    }

apparently, tracker.getCacheFile() yields null.


net.sourceforge.jnlp.LaunchException: Fatal: Read Error: Could not read or parse the JNLP file at 'http://DISCLOSED/DISCLOSED.jnlp'. You can try to download this file manually and send it as bug report to IcedTea-Web team.
	at net.sourceforge.jnlp.Launcher.fromUrl(Launcher.java:330)
	at net.sourceforge.jnlp.Launcher.launch(Launcher.java:190)
	at net.sourceforge.jnlp.runtime.Boot.launch(Boot.java:346)
	at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:326)
	at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:73)
	at java.security.AccessController.doPrivileged(Native Method)
	at net.sourceforge.jnlp.runtime.Boot.runMain(Boot.java:270)
	at net.sourceforge.jnlp.runtime.Boot.mainWithReturnCode(Boot.java:128)
	at net.sourceforge.jnlp.runtime.Boot.main(Boot.java:112)
	at com.openwebstart.launcher.PhaseTwoWebStartLauncher.main(PhaseTwoWebStartLauncher.java:72)
	at com.openwebstart.launcher.OpenWebStartLauncher.main(OpenWebStartLauncher.java:30)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:85)
	at com.exe4j.runtime.WinLauncher.main(WinLauncher.java:94)
	at com.install4j.runtime.launcher.WinLauncher.main(WinLauncher.java:25)
Caused by: java.io.IOException: java.lang.NullPointerException
	at net.sourceforge.jnlp.JNLPFileFactory.openURL(JNLPFileFactory.java:107)
	at net.sourceforge.jnlp.JNLPFileFactory.create(JNLPFileFactory.java:79)
	at net.sourceforge.jnlp.JNLPFileFactory.create(JNLPFileFactory.java:63)
	at net.sourceforge.jnlp.Launcher.fromUrl(Launcher.java:298)
	... 17 more
Caused by: java.lang.NullPointerException
	at java.io.FileInputStream.<init>(FileInputStream.java:130)
	at net.sourceforge.jnlp.JNLPFileFactory.openURL(JNLPFileFactory.java:103)
	... 20 more

@sclassen
Copy link
Member

sclassen commented Apr 1, 2020

Can you post the full log file please.
The reason why the cache is empty is that something went wrong during downloading.

@FelixJongleur42
Copy link
Author

Looks like the (manual) proxy settings where wrong and the jnlp file did not download at all.
Then I presume the proxy error was not handled correctly and JNLPFileFactory is called though the JNLP file did not get loaded.

failed to launch
netx: Read Error: Could not read or parse the JNLP file at 'http://HOSTNAME/path/file.jnlp'. (java.lang.NullPointerException ())
Error flag set for resource 'http://HOSTNAME/path/file.jnlp'. Can not return a local file for the resource
could not download resource location=http://HOSTNAME/path/file.jnlp version=null state=INCOMPLETE from any of theses urls [https://HOSTNAME/path/file.jnlp, http://HOSTNAME/path/file.jnlp]
Exception while downloading resource location=http://HOSTNAME/path/file.jnlp version=null state=INCOMPLETE from http://HOSTNAME/path/file.jnlp - Server returned HTTP response code: 503 for URL: http://HOSTNAME/path/file.jnlp
Proxies found for 'http://HOSTNAME/path/file.jnlp' : [HTTP @ proxy/123.123.123.123:8888]
Downloading location=http://HOSTNAME/path/file.jnlp version=null state=INCOMPLETE from http://HOSTNAME/path/file.jnlp
Exception while downloading resource location=http://HOSTNAME/path/file.jnlp version=null state=INCOMPLETE from https://HOSTNAME/path/file.jnlp - Unable to tunnel through proxy. Proxy returns "HTTP/1.0 404 Not Found"
Proxies found for 'https://HOSTNAME/path/file.jnlp' : [HTTP @ proxy/123.123.123.123:8888]
Downloading location=http://HOSTNAME/path/file.jnlp version=null state=INCOMPLETE from https://HOSTNAME/path/file.jnlp
Failed to determine best URL for location=http://HOSTNAME/path/file.jnlp version=null state=INCOMPLETE will try all of [https://HOSTNAME/path/file.jnlp, http://HOSTNAME/path/file.jnlp]
failed to determine best URL: java.lang.RuntimeException: All callables completed exceptionally:   - java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.0 404 Not Found"   - java.lang.RuntimeException: Server returned 503 for http://HOSTNAME/path/file.jnlp
For location=http://HOSTNAME/path/file.jnlp version=null state=INCOMPLETE the server returned 503 code for HEAD request for http://HOSTNAME/path/file.jnlp
URL connection 'http://HOSTNAME/path/file.jnlp' header fields: {null=[HTTP/1.0 503 Service Unavailable], X-Cache=[MISS from weblets], Server=[squid/3.1.12], X-Cache-Lookup=[MISS from weblets:7011], Connection=[keep-alive], X-Squid-Error=[ERR_DNS_FAIL 0], Content-Length=[3602], Mime-Version=[1.0], Date=[Mon, 06 Apr 2020 10:05:30 GMT], Via=[1.0 weblets (squid/3.1.12)], Content-Type=[text/html]}
Following exception should be harmless, but may help in finding root cause.
Proxies found for 'http://HOSTNAME/path/file.jnlp' : [HTTP @ proxy/123.123.123.123:8888]
While processing https://HOSTNAME/path/file.jnlp  by HEAD for resource location=http://HOSTNAME/path/file.jnlp version=null state=INCOMPLETE got Unable to tunnel through proxy. Proxy returns "HTTP/1.0 404 Not Found"
URL connection 'https://HOSTNAME/path/file.jnlp' header fields: {}
Following exception should be harmless, but may help in finding root cause.
Proxies found for 'https://HOSTNAME/path/file.jnlp' : [HTTP @ proxy/123.123.123.123:8888]
Candidate URLs for location=http://HOSTNAME/path/file.jnlp version=null state=INCOMPLETE: [https://HOSTNAME/path/file.jnlp, http://HOSTNAME/path/file.jnlp]
needsUpdateCheck: http://HOSTNAME/path/file.jnlp -> true
isCached: http://HOSTNAME/path/file.jnlp - (v: null) = true
isCached: remote size:32844 cached size:32844 -> true
result: null
call privileged method: getCodeBase

@sclassen
Copy link
Member

sclassen commented Apr 6, 2020

is it working now?
If yes, could you close this issue. Thanks

@FelixJongleur42
Copy link
Author

Well what do you consider fixed? I guess this issue is about improving the error handling in such a case. Something along the lines that the user is informed about the fact that the (re-)download failed due to some proxy error and that the user should check it‘s proxy settings. It would improve the user experience and help the user to fix the problem (instead of confronting him with a call stack and a NullPointerException).

@sclassen
Copy link
Member

sclassen commented Apr 8, 2020

Yes you are right, this would be the best case.
The problem is, that some applications have optional parts and it is OK for them to be missing.
So we cannot show an error to the user at the time a download fails (because we do not know if it is optional or mandatory)
So the earliest time we know that a resource is required is when we try to fetch it from the cache. But at that time we do no longer know why a resource failed to download.
I guess it would be possible to store the exceptions for all failed downloads somewhere and than fetch it from there during the cache access...

@FelixJongleur42
Copy link
Author

I am still experiencing this problem, steps to reproduce:

  1. set the proxy settings to something not working (e.g. an unknown proxy host)
  2. try to download jnlp - fails "normally"
  3. fix the proxy settings
  4. try to download jnlp again - the above NPE occurs
Caused by: java.io.IOException: java.lang.NullPointerException
	at net.sourceforge.jnlp.JNLPFileFactory.openURL(JNLPFileFactory.java:107)

Problem also is with Step 4 I don't know how to manually fix it.
In the official cache, there is nothing to delete.
I probably should open a ticket under IcedTea-Web ?

@sclassen
Copy link
Member

sclassen commented Jun 5, 2020

no need to open a second ticket as we are maintaining both OWS and ITW together

@FelixJongleur42
Copy link
Author

Sorry, I already did before I noticed your comment.

@sclassen sclassen changed the title JNLPFileFactory runs into NPE due to some cache problem JNLPFileFactory runs into NullPointerException after proxy settings where wrong Jun 12, 2020
@sclassen
Copy link
Member

sclassen commented Aug 6, 2020

We tried to reproduce the behavior.
Following your description we could not reproduce it.

But if we use a semi correct setting, then we can reproduce it.

So basically we did the following:

  1. completely wrong proxy setting -> error when trying to start application
  2. fixed proxy setting -> application starts
  3. semi correct settings -> NullPointer when trying to run applications

With semi correct settings I mean a host+port combination which exists but where there is another application (not a proxy) listening. In this case OWS can open a socket to the the semi correct proxy but will fail when starting the actual download.

@FelixJongleur42
Copy link
Author

FelixJongleur42 commented Aug 6, 2020

Ok thanks for narrowing this down.
Maybe „semi correct“ is also the following case:

  1. configure proxy 1 which cannot serve the file, e.g. cannot resolve the host name - possibly answering with a 503

2a. configure proxy 2 that would work (unless NPE)

2b. Configure „no proxy“ - which would work (unless NPE)

2c. Configure a proxy exclusion - which would work unless NPE

Maybe a/b/c would all produce the same error because 1. is the main cause. Maybe something wrong in the cache that believes the cached file is present but it‘s not.
I hope I did not confuse too much... ;) (I am on vacation and cannot test too much, thus only theory).

@janakmulani
Copy link
Contributor

Please let us know once you have tested. Thanks

@FelixJongleur42
Copy link
Author

Please let us know once you have tested. Thanks

Who do you mean? As I said I don‘t really have time to test.

@hendrikebbers
Copy link
Contributor

Well we hoped that you have time after vacation ;)

@FelixJongleur42
Copy link
Author

Looking for a temporary workaround (using 1.2.1 now).
Currently an URL is specified where the manual proxy setting is told to ignore this host, but the cached (?) jnlp file references a different host (in the codebase) than the host in the URL (this was caused by us).
Actually, the download URL was wrong (https instead of http) but Iced-Tea-Web found a cached file for that? (yet NPE)

A) Deleting "cache by app" for this host does not help, this somehow does not remove the cached JNLP file?

Manually looking for that JNLP Cache, does not seem to be under:
%LOCALAPPDATA%\Programs\OpenWebStart

So it seems to be here, trying to delete that:
del /q /s %USERPROFILE%\.cache\icedtea-web\cache

OK, the following workaround seems to work:

  1. fix codebase value in the jnlp file (server-side)
  2. fix proxy settings
  3. delete icedtea-web Cache (Windows command prompt - see above)

javaws-invocation.txt

@in-fke
Copy link

in-fke commented Nov 20, 2020

How can I re-open this ticket?
Even with 1.3.0 this happens, and: the workround does not seem to work anymore. I don't know what do delete so that this error goes away. WHAT do I need to delete in the cache?
I am willing to debug this - whatever it takes - because we keep running into this problem!

Again, the steps to reproduce:

  1. Vanilla install
  2. make proxy settings so download will not work
  3. fix proxy settings
  4. OWS runs into NPE

@sclassen sclassen reopened this Nov 20, 2020
@sclassen
Copy link
Member

To efficiently debug this we would need your help.

Could you please open the settings UI and make sure that logging to file and debug logging is activated.
Below the checkboxes you see the directory where the log files are written to.
Can you please go to this directory and delete/move all existing log files.

After this we need you to reproduce the error.
This should create log files.

Please attach all logs to this thread.

Thank you

@in-fke
Copy link

in-fke commented Nov 23, 2020

2020-11-23_10_04_06.790-ows-stage1.log
This is the log file.
In this case, the scenario was the following:

  1. It tried to download the file using a proxy, letting it fail
  2. the proxy settings where corrected not to use a proxy (the download would work here)
  3. the following tries always end up in this error

Maybe what is also relevent:
We are not "double-cliking" a downloaded JNLP file, but we are always using a launch like this:
%LOCALAPPDATA%\Programs\OpenWebStart\javaws.exe http://your-site/path-to/app.jnlp

Hope this helps?

@sclassen
Copy link
Member

The log contains the following line:

Exception while downloading resource location=http://your-site/path-to/app.jnlp version=null state=INCOMPLETE from http://your-site/path-to/app.jnlp - Request returned 301 for URL http://your-site/path-to/app.jnlp

HTTP Code 301 is Moved Permanently
Is there anything on you machine or in your network which caches requests and tries to speed them up by replying previous responses?

@in-fke
Copy link

in-fke commented Nov 23, 2020

Thanks for looking this up so fast. I was so overwhelmed by this error popping up again, but this may actually be solvable on our side. We will have to check but I think what we did was:

  1. set up HTTP to redirector from http to https
  2. told OWS Settings not to try to revert HTTPS

Then again the question should be:

  1. should OWS follow the redirect?
  2. is the OWS setting to strong for that? (as I understand the setting is whether OWS should automatically try to revert to HTTPS).
  3. I assume OWS is not implementing to follow the redirect?

@in-fke
Copy link

in-fke commented Nov 23, 2020

As an addition to the original Issue, maybe this is a "separate" issue on how OWS should react to HTTP 301?

@sclassen
Copy link
Member

OWS sends out a HEAD request prior to the GET request.
It does react to any 30x response in the HEAD request but will ignore these in the GET.

@FelixJongleur42
Copy link
Author

Ok, I cannot rename the ticket, it should state
JNLPFileFactory runs into NullPointerException when Server answered to GET with "301 Moved Permanently"

Workaround
del /q /s %USERPROFILE%\.cache\icedtea-web\cache
DOES work in this case (after jnlp file content was fixed).

In our Scenario, we had the following setup:

  1. HTTP Endpoint is set up to answer with 301 (see Apache example below)
  2. HTTPS Endpoint yields jnlp-File correctly, BUT
  3. JNLP File contains codebase and/or href attributes pointing to http
  4. OWS goes to those HTTP Endpoints and runs into NPE

Fix on user side:
Make sure JNLP contains HTTPS URLs if it's invoked via HTTPS

Possible fix on OWS side:
Follow 301 responses with GET Request as well

If you don't want to follow up on this ticket, that's ok, but please rename it as stated above to make it more clear.

<VirtualHost *:80>
  ServerName your-server-name
  Redirect permanent / https://your-server-name/
</VirtualHost>

@Jamila891 Jamila891 changed the title JNLPFileFactory runs into NullPointerException after proxy settings where wrong JNLPFileFactory runs into NullPointerException when Server answered to GET with "301 Moved Permanently" Dec 10, 2020
@sclassen
Copy link
Member

Does your server answer to HEAD requests?

@FelixJongleur42
Copy link
Author

I tested it, and yes it does.

curl --head http://<site>/<path-to>.jnlp
HTTP/1.1 301 Moved Permanently
Date: Sat, 12 Dec 2020 11:05:56 GMT
Server: Apache/2.4.23 (Linux/SUSE)
Location: https://<site>/<path-to>.jnlp
Content-Type: text/html; charset=iso-8859-1

@FelixJongleur42
Copy link
Author

I tried to narrow down the code where the download takes place, and ended up here:
https://github.com/AdoptOpenJDK/IcedTea-Web/blob/e3e147e1439b59cf9dfde9558a6dfe10025fd9ef/core/src/main/java/net/adoptopenjdk/icedteaweb/resources/downloader/BaseResourceDownloader.java#L160
and here
https://github.com/AdoptOpenJDK/IcedTea-Web/blob/e3e147e1439b59cf9dfde9558a6dfe10025fd9ef/core/src/main/java/net/adoptopenjdk/icedteaweb/resources/downloader/BaseResourceDownloader.java#L126

Is this the right track? Can't find any HEAD requests. And I can't find code that would follow redirects, either?
But maybe I am looking at the wrong code.

According to this:
https://stackoverflow.com/questions/1884230/httpurlconnection-doesnt-follow-redirect-from-http-to-https
the URLConnection would not follow a redirect automatically when there is a change of protocols.

@sclassen
Copy link
Member

Pretty close. The code which handles the redirecting is in https://github.com/AdoptOpenJDK/IcedTea-Web/blob/master/core/src/main/java/net/adoptopenjdk/icedteaweb/resources/initializer/BaseResourceInitializer.java
Check out the method testUrl on line 97

To further debug this you could enable debug logging and logging to file in the settings and then attach us a the stage 2 logfile to this issue.

@in-fke
Copy link

in-fke commented Jan 28, 2021

Here is another log, where it's not he HEAD but there was a SocketTimeoutException.
Therefore a SocketTimeoutException leeds to a NullPointerException, which is misleading in the error details (for the regular user).

[ITW-CORE][2021-01-28 11:13:50.893 MEZ][INFO ][net.adoptopenjdk.icedteaweb.resources.cache.LeastRecentlyUsedCache] isCached: http://<SITE>/soo/designer.jnlp - (v: null) = false
[ITW-CORE][2021-01-28 11:13:50.894 MEZ][DEBUG][net.adoptopenjdk.icedteaweb.resources.initializer.UnversionedResourceInitializer] needsUpdateCheck: http://<SITE>/soo/designer.jnlp -> true
[ITW-CORE][2021-01-28 11:13:50.894 MEZ][DEBUG][net.adoptopenjdk.icedteaweb.resources.initializer.UnversionedResourceInitializer] Candidate URLs for location=http://<SITE>/soo/designer.jnlp version=null state=INCOMPLETE: [http://<SITE>/soo/designer.jnlp]
[ITW-CORE][2021-01-28 11:13:50.898 MEZ][DEBUG][com.openwebstart.proxy.direct.DirectProxyProvider] Using NO_PROXY
[ITW-CORE][2021-01-28 11:13:50.901 MEZ][DEBUG][com.openwebstart.proxy.direct.DirectProxyProvider] Using NO_PROXY
[ITW-CORE][2021-01-28 11:13:55.901 MEZ][DEBUG][net.adoptopenjdk.icedteaweb.http.HttpUtils]
Following exception should be harmless, but may help in finding root cause.
java.net.SocketTimeoutException: connect timed out
	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:607)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
	at sun.net.www.http.HttpClient.New(HttpClient.java:339)
	at sun.net.www.http.HttpClient.New(HttpClient.java:357)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1226)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:990)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
	at net.adoptopenjdk.icedteaweb.http.CloseableConnection.getInputStream(CloseableConnection.java:58)
	at net.adoptopenjdk.icedteaweb.http.HttpUtils.consumeAndCloseConnection(HttpUtils.java:75)
	at net.adoptopenjdk.icedteaweb.http.HttpUtils.consumeAndCloseConnectionSilently(HttpUtils.java:62)
	at net.adoptopenjdk.icedteaweb.resources.initializer.UrlProber.getUrlResponseCodeWithRedirectionResult(UrlProber.java:67)
	at net.adoptopenjdk.icedteaweb.resources.initializer.BaseResourceInitializer.testUrl(BaseResourceInitializer.java:103)
	at net.adoptopenjdk.icedteaweb.resources.initializer.BaseResourceInitializer.lambda$null$0(BaseResourceInitializer.java:83)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
[ITW-CORE][2021-01-28 11:13:55.901 MEZ][DEBUG][net.adoptopenjdk.icedteaweb.resources.initializer.UrlProber] URL connection 'http://<SITE>/soo/designer.jnlp' header fields: {}
[ITW-CORE][2021-01-28 11:13:55.902 MEZ][DEBUG][net.adoptopenjdk.icedteaweb.resources.initializer.BaseResourceInitializer] While processing http://<SITE>/soo/designer.jnlp  by HEAD for resource location=http://<SITE>/soo/designer.jnlp version=null state=INCOMPLETE got connect timed out
[ITW-CORE][2021-01-28 11:13:55.903 MEZ][DEBUG][net.adoptopenjdk.icedteaweb.resources.initializer.BaseResourceInitializer] failed to determine best URL: java.util.concurrent.ExecutionException: java.net.SocketTimeoutException: connect timed out
[ITW-CORE][2021-01-28 11:13:55.903 MEZ][DEBUG][net.adoptopenjdk.icedteaweb.resources.initializer.UnversionedResourceInitializer] Failed to determine best URL for location=http://<SITE>/soo/designer.jnlp version=null state=INCOMPLETE will try all of [http://<SITE>/soo/designer.jnlp]
[ITW-CORE][2021-01-28 11:13:55.906 MEZ][DEBUG][net.adoptopenjdk.icedteaweb.resources.downloader.BaseResourceDownloader] Will download in background: http://<SITE>/soo/designer.jnlp
[ITW-CORE][2021-01-28 11:13:55.907 MEZ][DEBUG][com.openwebstart.proxy.direct.DirectProxyProvider] Using NO_PROXY
[ITW-CORE][2021-01-28 11:13:55.907 MEZ][DEBUG][com.openwebstart.proxy.direct.DirectProxyProvider] Using NO_PROXY
[ITW-CORE][2021-01-28 11:14:16.910 MEZ][DEBUG][net.adoptopenjdk.icedteaweb.resources.downloader.BaseResourceDownloader] Exception while downloading resource location=http://<SITE>/soo/designer.jnlp version=null state=INCOMPLETE from http://<SITE>/soo/designer.jnlp - Connection timed out: connect
[ITW-CORE][2021-01-28 11:14:16.910 MEZ][ERROR][net.adoptopenjdk.icedteaweb.resources.downloader.BaseResourceDownloader] could not download resource location=http://<SITE>/soo/designer.jnlp version=null state=INCOMPLETE from any of theses urls [http://<SITE>/soo/designer.jnlp]
[ITW-CORE][2021-01-28 11:14:16.911 MEZ][DEBUG][net.adoptopenjdk.icedteaweb.resources.ResourceTracker] Download done. Shutting down executor
[ITW-CORE][2021-01-28 11:14:16.911 MEZ][DEBUG][net.adoptopenjdk.icedteaweb.resources.ResourceTracker] Error flag set for resource 'http://<SITE>/soo/designer.jnlp'. Can not return a local file for the resource
[ITW-CORE][2021-01-28 11:14:16.912 MEZ][ERROR][net.sourceforge.jnlp.AbstractLaunchHandler]
netx: Read Error: Could not read or parse the JNLP file at 'http://<SITE>/soo/designer.jnlp'. (java.lang.NullPointerException ())
net.sourceforge.jnlp.LaunchException: Fatal: Read Error: Could not read or parse the JNLP file at 'http://<SITE>/soo/designer.jnlp'. You can try to download this file manually and send it as bug report to IcedTea-Web team.
	at net.sourceforge.jnlp.Launcher.fromUrl(Launcher.java:331)
	at net.sourceforge.jnlp.Launcher.launch(Launcher.java:191)
	at net.sourceforge.jnlp.runtime.Boot.launch(Boot.java:355)
	at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:335)
	at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:73)
	at java.security.AccessController.doPrivileged(Native Method)
	at net.sourceforge.jnlp.runtime.Boot.runMain(Boot.java:279)
	at net.sourceforge.jnlp.runtime.Boot.mainWithReturnCode(Boot.java:132)
	at net.sourceforge.jnlp.runtime.Boot.main(Boot.java:114)
	at com.openwebstart.launcher.PhaseTwoWebStartLauncher.main(PhaseTwoWebStartLauncher.java:81)
	at com.openwebstart.launcher.OpenWebStartLauncher.main(OpenWebStartLauncher.java:35)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:84)
	at com.exe4j.runtime.WinLauncher.main(WinLauncher.java:94)
	at com.install4j.runtime.launcher.WinLauncher.main(WinLauncher.java:25)
Caused by: java.io.IOException: java.lang.NullPointerException
	at net.sourceforge.jnlp.JNLPFileFactory.openURL(JNLPFileFactory.java:107)
	at net.sourceforge.jnlp.JNLPFileFactory.create(JNLPFileFactory.java:79)
	at net.sourceforge.jnlp.JNLPFileFactory.create(JNLPFileFactory.java:63)
	at net.sourceforge.jnlp.Launcher.fromUrl(Launcher.java:299)
	... 17 more
Caused by: java.lang.NullPointerException
	at java.io.FileInputStream.<init>(FileInputStream.java:130)
	at net.sourceforge.jnlp.JNLPFileFactory.openURL(JNLPFileFactory.java:103)
	... 20 more
[ITW-CORE][2021-01-28 11:14:16.912 MEZ][ERROR][net.sourceforge.jnlp.runtime.Boot]
failed to launch
net.sourceforge.jnlp.LaunchException: Fatal: Read Error: Could not read or parse the JNLP file at 'http://<SITE>/soo/designer.jnlp'. You can try to download this file manually and send it as bug report to IcedTea-Web team.
	at net.sourceforge.jnlp.Launcher.fromUrl(Launcher.java:331)
	at net.sourceforge.jnlp.Launcher.launch(Launcher.java:191)
	at net.sourceforge.jnlp.runtime.Boot.launch(Boot.java:355)
	at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:335)
	at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:73)
	at java.security.AccessController.doPrivileged(Native Method)
	at net.sourceforge.jnlp.runtime.Boot.runMain(Boot.java:279)
	at net.sourceforge.jnlp.runtime.Boot.mainWithReturnCode(Boot.java:132)
	at net.sourceforge.jnlp.runtime.Boot.main(Boot.java:114)
	at com.openwebstart.launcher.PhaseTwoWebStartLauncher.main(PhaseTwoWebStartLauncher.java:81)
	at com.openwebstart.launcher.OpenWebStartLauncher.main(OpenWebStartLauncher.java:35)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:84)
	at com.exe4j.runtime.WinLauncher.main(WinLauncher.java:94)
	at com.install4j.runtime.launcher.WinLauncher.main(WinLauncher.java:25)
Caused by: java.io.IOException: java.lang.NullPointerException
	at net.sourceforge.jnlp.JNLPFileFactory.openURL(JNLPFileFactory.java:107)
	at net.sourceforge.jnlp.JNLPFileFactory.create(JNLPFileFactory.java:79)
	at net.sourceforge.jnlp.JNLPFileFactory.create(JNLPFileFactory.java:63)
	at net.sourceforge.jnlp.Launcher.fromUrl(Launcher.java:299)
	... 17 more
Caused by: java.lang.NullPointerException
	at java.io.FileInputStream.<init>(FileInputStream.java:130)
	at net.sourceforge.jnlp.JNLPFileFactory.openURL(JNLPFileFactory.java:103)
	... 20 more
[ITW-CORE][2021-01-28 11:14:16.917 MEZ][DEBUG][net.sourceforge.jnlp.runtime.Boot] Exiting Boot.mainWithReturnCode() with 1
[ITW-CORE][2021-01-28 11:14:16.917 MEZ][DEBUG][net.sourceforge.jnlp.runtime.JNLPRuntime] Waiting for exception dialog to be closed

@in-fke
Copy link

in-fke commented Jan 28, 2021

Current hypothesis:
The NPE occurs if the UnversionedResourceInitializer flags state=INCOMPLETE, and the JNLPFileFactory should not be bothered in the first place?

@sclassen
Copy link
Member

Yes, this is true. the NPE is kind of unfortunate as it hiding the real reason which is a failing in download.
Never the less the BaseResouceInitializer should take care of the redirect. Therefore it should not occur.

@in-fke
Copy link

in-fke commented Jan 29, 2021

Never the less the BaseResouceInitializer should take care of the redirect. Therefore it should not occur.

Well in this case it was a SocketTimeoutException, so it's a more general question on how BaseResouceInitializer handles problems an how it passes them on (e.g. state=INCOMPLETE), and how the "caller" deals with it.

@sclassen
Copy link
Member

sclassen commented Feb 5, 2021

The ResourceInitializer has the job to determine if the resource is already in the cache and if it needs a refresh or download.
If it finds that the resource needs to be downloaded it will also try to find the best URL to do so (there are some quirks and "improvements" to downloading and versioning which were introduced into the Oracle Web Start, thus there are multiple URLs to check...).
To achieve this it will probe the server using HEAD requests. If it finds a suitable URL it will pass this to the ResourceDownloader.
If it cannot find a URL (e.g. because some server do not react to the HEAD requests) it passes all possible URLs to the ResourceDownloader which will then try one after the other until it was successful or runs out of URLs to try

@in-fke
Copy link

in-fke commented Dec 21, 2021

Problem persists with 1.5.0.
Even worse now it seems, the "Clean by App" / "domain" is unable to delete the file. (pressing the button "nothing happens").

Yet only practical workaround seems to be:
del /q /s %USERPROFILE%\.cache\icedtea-web\cache

net.sourceforge.jnlp.LaunchException: Fatal: Read Error: Could not read or parse the JNLP file at 'https://localhost/<PATH>'. You can try to download this file manually and send it as bug report to IcedTea-Web team.
	at net.sourceforge.jnlp.Launcher.fromUrl(Launcher.java:332)
	at net.sourceforge.jnlp.Launcher.launch(Launcher.java:192)
	at net.sourceforge.jnlp.runtime.Boot.launch(Boot.java:355)
	at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:335)
	at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:73)
	at java.security.AccessController.doPrivileged(Native Method)
	at net.sourceforge.jnlp.runtime.Boot.runMain(Boot.java:279)
	at net.sourceforge.jnlp.runtime.Boot.mainWithReturnCode(Boot.java:132)
	at net.sourceforge.jnlp.runtime.Boot.main(Boot.java:114)
	at com.openwebstart.launcher.PhaseTwoWebStartLauncher.main(PhaseTwoWebStartLauncher.java:86)
	at com.openwebstart.launcher.OpenWebStartLauncher.main(OpenWebStartLauncher.java:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:84)
	at com.exe4j.runtime.WinLauncher.main(WinLauncher.java:94)
	at com.install4j.runtime.launcher.WinLauncher.main(WinLauncher.java:25)
Caused by: java.io.IOException: java.lang.NullPointerException
	at net.sourceforge.jnlp.JNLPFileFactory.openURL(JNLPFileFactory.java:107)
	at net.sourceforge.jnlp.JNLPFileFactory.create(JNLPFileFactory.java:79)
	at net.sourceforge.jnlp.JNLPFileFactory.create(JNLPFileFactory.java:63)
	at net.sourceforge.jnlp.Launcher.fromUrl(Launcher.java:300)
	... 17 more
Caused by: java.lang.NullPointerException
	at java.io.FileInputStream.<init>(FileInputStream.java:130)
	at net.sourceforge.jnlp.JNLPFileFactory.openURL(JNLPFileFactory.java:103)
	... 20 more

@janakmulani
Copy link
Contributor

Yes this is a bug. We are in the process of fixing it see AdoptOpenJDK/IcedTea-Web#846

@FelixJongleur42
Copy link
Author

Great to here that progress is being made on this topic!

@AlBundy33
Copy link

since AdoptOpenJDK/IcedTea-Web#846 is closed maybe this one can be closed too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants