Posted February 16, 20187 yr Hey, my problem is with the SSL Engine of Forge: In every Init event (Pre, Init, Post) the HTTPS connection to my server fails with this exception: Spoiler [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1917) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:301) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:295) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1471) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:212) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.Handshaker.processLoop(Handshaker.java:936) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.Handshaker.process_record(Handshaker.java:871) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1043) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1343) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1371) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1355) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1511) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.net.www.protocol.http.HttpURLConnection.access$200(HttpURLConnection.java:90) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1431) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1429) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at java.security.AccessController.doPrivileged(Native Method) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at java.security.AccessController.doPrivileged(AccessController.java:713) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1428) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at java.net.URL.openStream(URL.java:1038) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at org.apache.commons.io.IOUtils.toString(IOUtils.java:1153) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at de.fuzzlemann.ucutils.utils.punishment.PunishManager.fillViolationList(PunishManager.java:27) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at de.fuzzlemann.ucutils.Main.lambda$postInit$0(Main.java:63) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at de.fuzzlemann.ucutils.Main$$Lambda$104/500004675.run(Unknown Source) [13:12:31] [Thread-16/INFO]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at java.lang.Thread.run(Thread.java:745) [13:12:31] [Thread-16/INFO]: [java.lang.Throwable:printStackTrace:634]: Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [13:12:31] [Thread-16/INFO]: [java.lang.Throwable:printStackTrace:634]: at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387) [13:12:31] [Thread-16/INFO]: [java.lang.Throwable:printStackTrace:634]: at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292) [13:12:31] [Thread-16/INFO]: [java.lang.Throwable:printStackTrace:634]: at sun.security.validator.Validator.validate(Validator.java:260) [13:12:31] [Thread-16/INFO]: [java.lang.Throwable:printStackTrace:634]: at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324) [13:12:31] [Thread-16/INFO]: [java.lang.Throwable:printStackTrace:634]: at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229) [13:12:31] [Thread-16/INFO]: [java.lang.Throwable:printStackTrace:634]: at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124) [13:12:31] [Thread-16/INFO]: [java.lang.Throwable:printStackTrace:634]: at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1453) [13:12:31] [Thread-16/INFO]: [java.lang.Throwable:printStackTrace:634]: ... 23 more [13:12:31] [Thread-16/INFO]: [java.lang.Throwable:printStackTrace:643]: Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [13:12:31] [Thread-16/INFO]: [java.lang.Throwable:printStackTrace:643]: at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:145) [13:12:31] [Thread-16/INFO]: [java.lang.Throwable:printStackTrace:643]: at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:131) [13:12:31] [Thread-16/INFO]: [java.lang.Throwable:printStackTrace:643]: at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280) [13:12:31] [Thread-16/INFO]: [java.lang.Throwable:printStackTrace:643]: at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382) [13:12:31] [Thread-16/INFO]: [java.lang.Throwable:printStackTrace:643]: ... 29 more The code: Spoiler package de.fuzzlemann.ucutils; import de.fuzzlemann.ucutils.update.UpdateReminder; import de.fuzzlemann.ucutils.utils.command.CommandHandler; import de.fuzzlemann.ucutils.utils.config.ConfigUtil; import de.fuzzlemann.ucutils.utils.faction.badfaction.DrugUtil; import de.fuzzlemann.ucutils.utils.faction.police.WantedManager; import de.fuzzlemann.ucutils.utils.noobchat.NoobChatManager; import de.fuzzlemann.ucutils.utils.punishment.PunishManager; import net.minecraft.client.Minecraft; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import java.io.IOException; /** * @author Fuzzlemann */ @SideOnly(Side.CLIENT) @Mod(name = Main.NAME, modid = Main.MOD_ID, version = Main.VERSION, clientSideOnly = true, guiFactory = Main.GUI_FACTORY) public class Main { public static final Minecraft MINECRAFT = Minecraft.getMinecraft(); public static final String MOD_ID = "ucutils"; public static final String VERSION = "1.12.1-1.4"; static final String NAME = "UC Utils"; static final String GUI_FACTORY = "de.fuzzlemann.ucutils.utils.config.GuiFactoryUCUtils"; @Mod.EventHandler public void preInit(FMLPreInitializationEvent e) { ConfigUtil.config = new Configuration(e.getSuggestedConfigurationFile()); ConfigUtil.syncConfig(); } @Mod.EventHandler public void init(FMLInitializationEvent e) { CommandHandler.registerAllCommands(); } @Mod.EventHandler public void postInit(FMLPostInitializationEvent e) { new Thread(() -> { try { UpdateReminder.updateUpdateNeeded(); } catch (IOException exc) { UpdateReminder.updateNeeded = false; } try { WantedManager.fillWantedList(); } catch (IOException exc) { WantedManager.readSavedWantedList(); } try { PunishManager.fillViolationList(); NoobChatManager.fillNoobChatAnswerList(); } catch (IOException e1) { e1.printStackTrace(); } DrugUtil.loadDrugs(); }).start(); } } public static void fillViolationList() throws IOException { URL url = new URL("https://fuzzlemann.de/violations.html"); String result = IOUtils.toString(url, StandardCharsets.UTF_8); String[] jsonList = result.split("\n"); Gson gson = new Gson(); for (String json : jsonList) { VIOLATIONS.add(gson.fromJson(json, Violation.class)); } } As I already mentioned before, I tried the SSL Connection methods in every other initialization event too. The weird thing with that error is, that if I for example implement this method into a command of mine, it works flawlessly and without errors. When I switch to HTTP, everything works alright again. Details: Forge Version: 1.12.1 - 14.22.1.2485 Java Version: Java 1.8.0_25 (included one) Forge Mods installed: My mod, Damage Indicator, ItemPhysics Lite, Optifine LiteLoader Mods installed: Macro Mod, WorldEditCUI JVM Arguments: -Xmx5G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=16M Edited February 16, 20187 yr by Fuzzlemann
February 16, 20187 yr Author Yes, it works in every other non-Minecraft Java project. And I forgot to mention that it works when I use the Test Configuration of Forge.
February 16, 20187 yr Author Same error: Spoiler [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1917) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:301) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:295) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1471) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:212) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.Handshaker.processLoop(Handshaker.java:936) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.Handshaker.process_record(Handshaker.java:871) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1043) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1343) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1371) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1355) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1511) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.net.www.protocol.http.HttpURLConnection.access$200(HttpURLConnection.java:90) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1431) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1429) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at java.security.AccessController.doPrivileged(Native Method) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at java.security.AccessController.doPrivileged(AccessController.java:713) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1428) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at java.net.URL.openStream(URL.java:1038) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at org.apache.commons.io.IOUtils.toString(IOUtils.java:1153) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at de.fuzzlemann.ucutils.utils.punishment.PunishManager.fillViolationList(PunishManager.java:27) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at de.fuzzlemann.ucutils.Main.lambda$postInit$0(Main.java:63) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at de.fuzzlemann.ucutils.Main$$Lambda$104/1147211937.run(Unknown Source) [16:12:02] [Thread-13/INFO] [STDERR]: [de.fuzzlemann.ucutils.Main:lambda$postInit$0:66]: at java.lang.Thread.run(Thread.java:745) [16:12:02] [Thread-13/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [16:12:02] [Thread-13/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387) [16:12:02] [Thread-13/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292) [16:12:02] [Thread-13/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: at sun.security.validator.Validator.validate(Validator.java:260) [16:12:02] [Thread-13/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324) [16:12:02] [Thread-13/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229) [16:12:02] [Thread-13/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124) [16:12:02] [Thread-13/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1453) [16:12:02] [Thread-13/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: ... 23 more [16:12:02] [Thread-13/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:643]: Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [16:12:02] [Thread-13/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:643]: at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:145) [16:12:02] [Thread-13/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:643]: at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:131) [16:12:02] [Thread-13/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:643]: at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280) [16:12:02] [Thread-13/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:643]: at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382) [16:12:02] [Thread-13/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:643]: ... 29 more
February 16, 20187 yr Author Testing with JDK 1.8.0_144 -> Working fine. Others having the same problem with the included Java, any other solution outside of staying at HTTP? Edited February 16, 20187 yr by Fuzzlemann
February 16, 20187 yr or maybe this can help Quote InputStream in = null; try { in = new URL(versionFileLink).openStream(); org.apache.commons.io.IOUtils.toString(in, StandardCharsets.UTF_8); } catch (MalformedURLException e) { LoggerHelp.warn("MalFormedUrlExpection : " + e); return; } catch (IOException e) { LoggerHelp.warn("Maybe wrong input : " + e); return; } Always looking for new challenges, and happy to help the people where ever I can
February 16, 20187 yr Author 22 minutes ago, diesieben07 said: Sounds like the trusted certificates includes with the outdated Java version shipped by the launcher reject your SSL certificate. Probably related to you using Let's Encrypt (which is fine). I don't think you have much choice except using modern Java or switching to either HTTP or a different certificate authority. Edit: Yes, Let's Encrypt Authorities were added in Update 101: https://stackoverflow.com/a/34111150/3638966. Oh, thanks for your clarification and your help. 12 minutes ago, sir_titi said: or maybe this can help Not sure how that should help in any way.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.