mind404
mind404
JCHJava Community | Help. Code. Learn.
Created by mind404 on 9/26/2024 in #java-help
Jetty base resource help
Hey, I have a java app and I'm using jetty server I used to have this code context.setBaseResource( Resource.newResource( WebConfigurationProvider.class.getResource( "webapp" ) ) ); But after upgrading to jetty 12, Resource.newResource isn't available anymore I replaced it with
Container resourceHandler = new ResourceHandler();
context.setBaseResource( ResourceFactory.of( resourceHandler ).newResource( WebConfigurationProvider.class.getResource( "webapp" ) ) );
Container resourceHandler = new ResourceHandler();
context.setBaseResource( ResourceFactory.of( resourceHandler ).newResource( WebConfigurationProvider.class.getResource( "webapp" ) ) );
This is now causing an exception when the app is built and ran because the resource is in a pkg file pkg://server-config.pkg/com/mirada/cerberus/config/webapp/ java.nio.file.FileSystemNotFoundException: Provider "pkg" not installed pkg is actually not in the FileSystemProvider.installedProviders() hence why this is happening when the path is trying to be fetched I'm kind of stuck, not sure what to try anymore I'm not sure if it's a jetty thing or like java thing because the providers are in java.nio.file.spi, I have file, jar and jrt but i don't have pkg, and jetty is not using that it's simply when it tries to do Path.of(uri)
11 replies