If you’re getting a 404, it doesn’t mean the scanning isn’t happening, it means Jersey doesn’t register ApiListingResource for some reason (even though it’s in your ResourceConfig).
ApiListingResource is just a JAX-RS resource like your own – which should be exposed at the root of the other resources. You’re also using a really old version of swagger-core – that version has many known issues, some of which are critical. Try upgrading to the latest – 1.5.12. From: <[email protected]> on behalf of Dali <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Wednesday, 28 December 2016 at 5:23 To: Swagger <[email protected]> Subject: Re: Can't get swagger.json I'm using swagger-core 1.5.0 My API is accessible on http://localhost:5003/v1/ I think that the swagger.json is not created. I tried http://localhost:5003/v1/swagger.json or http://localhost:5003/swagger.json but it's always an 404. On Tuesday, December 27, 2016 at 7:20:59 PM UTC+1, Ron wrote: Which version of swagger-core do you use? What URL do you use to access your API? The swagger.json? From: <[email protected]> on behalf of Dali <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Tuesday, 27 December 2016 at 10:16 To: Swagger <[email protected]> Subject: Can't get swagger.json Hello, I tried to integrate swagger on java + embedded jetty project but i can't get swagger.json file. I'm always getting 404 not found error on any path combination. I think swagger is not scanning my packages !?! Main.java public class ApiServer { public static void main(String[] args) throws Exception { BeanConfig beanConfig = new BeanConfig(); beanConfig.setVersion("1.0.0"); beanConfig.setResourcePackage("my.resources.packages"); beanConfig.setScan(true); beanConfig.setBasePath("/"); beanConfig.setPrettyPrint(true); Server server = new Server(Env.SERVER_PORT); ServletHolder jerseyServletHolder = new ServletHolder(new ServletContainer()); jerseyServletHolder.setInitParameter(ServerProperties.PROVIDER_PACKAGES,"my.resources.packages;com.fasterxml.jackson.jaxrs.json"); jerseyServletHolder.setInitParameter(ServerProperties.WADL_FEATURE_DISABLE, ServletContextHandler handler = new ServletContextHandler(server, "/"); "true"); handler.addServlet(jerseyServletHolder, Env.API_PREFIX); server.start(); server.join(); } @ApplicationPath("/") public class Application extends ResourceConfig { public Application() { // Register all resources present under the package. packages("my.resources.packages"); packages("com.fasterxml.jackson.jaxrs.json"); register(JacksonFeature.class); register(ApiListingResource.class); register(SwaggerSerializers.class); } } I'm using jersey 2.22 and swagger 1.5. My API classes (and swagger annotations) are under my.resources.packages My Api calls works All help appreciated Regards, Dali p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #777777} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px} p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #4e9072} p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #3933ff} span.s1 {color: #000000} span.s2 {color: #3933ff} span.s3 {color: #931a68} -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
