Opening screen with database(or just use database)
Getting error
[17:07:50] [Render thread/ERROR]: [SQLib] Failed to connect to database!
[17:07:50] [Render thread/ERROR]: [SQLib] HikariDataSource HikariDataSource (HikariPool-2) has been closed.
[17:07:50] [Render thread/WARN]: Could not initialize owo screen
java.lang.NullPointerException: Cannot invoke "java.sql.PreparedStatement.getResultSet()" because "stmt" is null
at me.mrnavastar.sqlib.sql.SQLConnection.readField(SQLConnection.java:141) ~[transformed-mod-sqlib.i0:0/:?]
at me.mrnavastar.sqlib.DataContainer.getString(DataContainer.java:90) ~[transformed-mod-sqlib.i0:0/:?]
at ua.mei.spwp.client.SPWorldsPayDatabase.lambda$getCards$0(SPWorldsPayDatabase.java:44) ~[transformed-mod-spwp.i0:0/:?]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
at java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:720) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[?:?]
at ua.mei.spwp.client.SPWorldsPayDatabase.getCards(SPWorldsPayDatabase.java:45) ~[transformed-mod-spwp.i0:0/:?]
at ua.mei.spwp.client.SPWorldsPayDatabase.getCards(SPWorldsPayDatabase.java:50) ~[transformed-mod-spwp.i0:0/:?]
at ua.mei.spwp.client.screens.or.ORScreen.build(ORScreen.java:38) ~[transformed-mod-spwp.i0:0/:?]
at ua.mei.spwp.client.screens.or.ORScreen.build(ORScreen.java:17) ~[transformed-mod-spwp.i0:0/:?]
at io.wispforest.owo.ui.base.BaseOwoScreen.method_25426(BaseOwoScreen.java:90) ~[transformed-mod-owo.i0:0/:?]
at net.minecraft.class_437.method_25423(class_437.java:297) ~[transformed-mod-minecraft.i0:0/:?]
at net.minecraft.class_310.method_1507(class_310.java:1080) ~[transformed-mod-minecraft.i0:0/:?]
at ua.mei.spwp.client.SPWorldsPayClient.lambda$onInitializeClient$1(SPWorldsPayClient.java:45) ~[transformed-mod-spwp.i0:0/:?]
at org.quiltmc.qsl.lifecycle.api.client.event.ClientTickEvents.lambda$static$2(ClientTickEvents.java:52) ~[transformed-mod-quilt-lifecycle-events.i0:0/:?]
at net.minecraft.class_310.handler$zpj001$quilt_lifecycle_events$endTick(class_310.java:8056) ~[transformed-mod-minecraft.i0:0/:?]
at net.minecraft.class_310.method_1574(class_310.java:1957) ~[transformed-mod-minecraft.i0:0/:?]
at net.minecraft.class_310.method_1523(class_310.java:1181) ~[transformed-mod-minecraft.i0:0/:?]
at net.minecraft.class_310.method_1514(class_310.java:802) ~[transformed-mod-minecraft.i0:0/:?]
at net.minecraft.client.main.Main.main(Main.java:250) ~[minecraft-1.20.1-client.jar:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
at org.quiltmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:524) ~[quilt-loader-0.20.2.jar:?]
at org.quiltmc.loader.impl.launch.knot.Knot.launch(Knot.java:82) ~[quilt-loader-0.20.2.jar:?]
at org.quiltmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:28) ~[quilt-loader-0.20.2.jar:?]
at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:87) ~[NewLaunch.jar:?]
at org.prismlauncher.EntryPoint.listen(EntryPoint.java:130) ~[NewLaunch.jar:?]
at org.prismlauncher.EntryPoint.main(EntryPoint.java:70) ~[NewLaunch.jar:?]
Part of code:
public List<Card> getCards(Server server) {
List<DataContainer> dataContainers = switch(server) {
case SP -> spCards.getDataContainers();
case SPm -> spmCards.getDataContainers();
};
return dataContainers.stream()
.map(data -> new Card(data.getIdAsInt(), data.getString("name"), data.getIdentifier("texture"), data.getString("cardId"), data.getString("token"), server))
.collect(Collectors.toList());
}
Tip:
Instead of using ServerLifecycleEvents.SERVER_STOPPING.register(server -> databases.forEach(Database::close)); use ClientLifecycleEvents.CLIENT_STOPPING.register(client -> databases.forEach(Database::close));
SQLib 2.2.7 Minecraft 1.20(.1) Crash log:
Getting error
Part of code:
Tip: Instead of using
ServerLifecycleEvents.SERVER_STOPPING.register(server -> databases.forEach(Database::close));
useClientLifecycleEvents.CLIENT_STOPPING.register(client -> databases.forEach(Database::close));