Closed ThraaxSession closed 1 year ago
This is an issue in your code, you are incorrectly converting the URL returned by getResource into a file here: https://github.com/SpaceUp-Cloud/SpaceUp-Server/blob/0ce749634ec7c4cbc129a7e829dbdd305073b0a9/src/main/kotlin/technology/iatlas/spaceup/services/SshService.kt#L236-L241
When the application is packaged as a jar, the resources are entries in that jar file, they are not individual files on the file system. They have a proper URL (the one returned by getResource), but those URLs do not have an associated java.io.File, because they're inside the jar. You can probably call URL.openStream and pass the stream directly, though.
@yawkat oh yes, face palm to me. I changed that 2 weeks ago. My bad.
Expected Behavior
When the JAR is directly used, the
ResourceLoader
can load any resource fromResources
Actual Behaviour
I get a call stack, when I want to get a resource from JAR. When I run from Idea, it works fine.
In Kotlin constructor:
private val resourceLoader: ResourceLoader
Actual call:val logsScript = resourceLoader.getResource("commands/getLogs.sh")
Steps To Reproduce
Environment Information
GraalVM 22 / Java 11 Micronaut 3.7.3
Example Application
Here is the service which crashes
Version
3.7.3