Aze
Explore posts from serversJCHJava Community | Help. Code. Learn.
•Created by Aze on 11/1/2024 in #java-help
Gradle, Ebean: Service loader didn't find a SpiContainerFactory?
Hey, I'm having a problem with Ebean at the moment and hope someone here is able to help.
It's the first time I'm using Gradle and the first time I'm using Ebean in private, so sorry if there's any obvious mistakes.
This is the config I had using the "Getting Started" documentation:
Then I got an error message stating I should use driver specific packages (since Ebean 13+), which wasn't documented for gradle, so I checked out the Maven page and came up with this:
Now I'm getting an error about
SpiContainerFactory
not being found, even though the class is part of my jar.
DatabaseProvider: https://paste.helpch.at/igogeyiraf.java
Error: https://paste.helpch.at/dihajofopi.rb (also without shading)13 replies
JCHJava Community | Help. Code. Learn.
•Created by Aze on 5/3/2024 in #java-help
Annotations - interface as attribute type
Hey, I haven't found any useful resources on this. Maybe I'm using the wrong keywords, so I figured I should ask here:
Why do annotations not allow interfaces as attribute types?
For some more context: I actually want to pass an enum, but use an interface to define a standard method (implementation can vary).
This is just an example:
13 replies
JCHJava Community | Help. Code. Learn.
•Created by Aze on 1/30/2024 in #java-help
Supplier alternative
Hey! I have some optional dependencies in my
pom.xml
(scope: provided).
Now for each dependency I have a Hook class, which I would like to create an object of if the dependency is found.
The following has bee confirmed to work:
While this works, it comes at the cost of having a bunch of code when handling multiple dependencies.
So what I came up with instead is:
This cleans up my code base quite a bit, however, this will cause a java.lang.NoClassDefFoundError
, which I believe is caused by the static reference of the hook?
Can someone help me figure out an alternative? Any help is greatly appreciated^^8 replies
JCHJava Community | Help. Code. Learn.
•Created by Aze on 10/17/2022 in #java-help
Nitrite Database
I need help with Nitrite
I followed these docs on how to open the database and how to open collections:
https://www.dizitart.org/nitrite-database/#create-open-database
https://www.dizitart.org/nitrite-database/#create-open-collections
but no matter what I do, once I call the database or collection all I get is
null
.
The error:
https://pastebin.com/MxPemz0i
My code:
https://pastebin.com/Sy0SVqnh
(the startDatabase() method is being called on start)12 replies
JCHJava Community | Help. Code. Learn.
•Created by Aze on 10/5/2022 in #java-help
need help with BigDecimal rounding
Hey, I'm trying to round a BigDecimal, but it doesn't seem to be working? I'm not sure if I'm doing it wrong or not.
judging by the docs https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/RoundingMode.html#DOWN I was expecting the amount to be
2
, but instead it's 2.18
4 replies