0

When loading http://127.0.0.1:3000 I get this error:

java.lang.Throwable: Unknown error
        at [email protected]/javafx.scene.web.WebEngine$LoadWorker.describeError(WebEngine.java:1444)
        at [email protected]/javafx.scene.web.WebEngine$LoadWorker.dispatchLoadEvent(WebEngine.java:1383)
        at [email protected]/javafx.scene.web.WebEngine$PageLoadListener.dispatchLoadEvent(WebEngine.java:1244)
        at [email protected]/com.sun.webkit.WebPage.fireLoadEvent(WebPage.java:2563)
        at [email protected]/com.sun.webkit.WebPage.fwkFireLoadEvent(WebPage.java:2407)
        at [email protected]/com.sun.webkit.network.URLLoaderBase.twkDidFail(Native Method)
        at [email protected]/com.sun.webkit.network.HTTP2Loader.notifyDidFail(HTTP2Loader.java:628)
        at [email protected]/com.sun.webkit.network.HTTP2Loader.lambda$didFail$18(HTTP2Loader.java:610)
        at [email protected]/com.sun.webkit.network.HTTP2Loader.lambda$callBackIfNotCanceled$10(HTTP2Loader.java:441)
        at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
        at [email protected]/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
        at [email protected]/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at [email protected]/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
        at java.base/java.lang.Thread.run(Thread.java:833)

It is also possible to get a 'Connection refused by server' error when loading a page on port 3000, but not a local one:

java.lang.Throwable: Connection refused by server
        at [email protected]/javafx.scene.web.WebEngine$LoadWorker.describeError(WebEngine.java:1444)
        at [email protected]/javafx.scene.web.WebEngine$LoadWorker.dispatchLoadEvent(WebEngine.java:1383)
        at [email protected]/javafx.scene.web.WebEngine$PageLoadListener.dispatchLoadEvent(WebEngine.java:1244)
        at [email protected]/com.sun.webkit.WebPage.fireLoadEvent(WebPage.java:2563)
        at [email protected]/com.sun.webkit.WebPage.fwkFireLoadEvent(WebPage.java:2407)
        at [email protected]/com.sun.webkit.network.URLLoaderBase.twkDidFail(Native Method)
        at [email protected]/com.sun.webkit.network.HTTP2Loader.notifyDidFail(HTTP2Loader.java:628)
        at [email protected]/com.sun.webkit.network.HTTP2Loader.lambda$didFail$18(HTTP2Loader.java:610)
        at [email protected]/com.sun.webkit.network.HTTP2Loader.lambda$callBackIfNotCanceled$10(HTTP2Loader.java:441)
        at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
        at [email protected]/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
        at [email protected]/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at [email protected]/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
        at java.base/java.lang.Thread.run(Thread.java:833)

I have tried this but without success:

HostnameVerifier allHostsValid = new HostnameVerifier() {
            public boolean verify(String hostname, SSLSession session) {
                return true;
            }
        };
        HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);

And it:

TrustManager[] trustAllCerts = new TrustManager[] {
                new X509TrustManager() {
                    public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                        return null;
                    }
                    public void checkClientTrusted(
                            java.security.cert.X509Certificate[] certs, String authType) {
                    }
                    public void checkServerTrusted(
                            java.security.cert.X509Certificate[] certs, String authType) {
                    }
                }
        };

        try {
            SSLContext sc = SSLContext.getInstance("SSL");
            sc.init(null, trustAllCerts, new java.security.SecureRandom());
            HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
        } catch (GeneralSecurityException e) {
            System.out.println("SSL trust error: " + e.getMessage());
        }

Errors occur along with the status Worker.State.FAILED. With what it can be connected?

3
  • Given you're connecting to localhost, I assume you have control of this server? Do the server logs give any indication of what went wrong? Commented Sep 27, 2022 at 5:58
  • @Slaw, I don't control the server. I gave the application to a colleague, he launched it on his PC and opened localhost, but nothing happened. The page itself didn't load and didn't even show an error. Was open the previous site. In other browsers and in the webview on Android, this server opens normally and at least displays an error. Therefore, I immediately began to look for a problem in javafx.web. Do you think that the server can somehow influence this? Commented Sep 27, 2022 at 21:15
  • It's possible that javafx.web is sending a weird request. But the error on the JavaFX side does not give much information. That's why I'd look at the server, to see if it gives more information on its end. Commented Sep 27, 2022 at 22:17

1 Answer 1

1

This worked for me and the pages now run, but it still doesn't work well. Some pages on port 3000 open and then redirect to index.html, which shouldn't happen.:

System.setProperty("http.proxyHost","my.site.com");
System.setProperty("http.proxyPort","3000");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.