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?
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.: