Marcus Ilgner
11/21/2024, 12:07 PMresolveResource function underlying the staticResources function ultimately has the option to pass in the class loader, but staticResources itself doesn't have it. This is a modular application which loads functionality from plugins, so the Ktor classloader doesn't have access to the resources of the plugins.
Any tips?Aleksei Tirman [JB]
11/21/2024, 12:46 PMMarcus Ilgner
11/26/2024, 3:36 PMApplication might be an option... 🤔 It's not optimal as using the same class loader for all resources would result in issues when multiple plugins use the same name for some resources, though. My current plan was to have individual staticResources blocks, one for each plugin - with different paths, of course - and using the appropriate class loader.
But out of curiosity: where would I have to set it? My main function currently looks only like
fun main(args: Array<String>) {
io.ktor.server.netty.EngineMain.main(args)
}
and this loads the configuration YAML that provides the module name and then ends up executing Application.myModule()
Inside that module is the initialization code that also builds the classloader which wraps the classloaders of all the plugins and their resources.Aleksei Tirman [JB]
11/26/2024, 3:54 PMembeddedServer to specify the class loader.