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);
}
}
Which version of swagger-core do you use?
What URL do you use to access your API?
The swagger.json?
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 swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
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: <swagger-sw...@googlegroups.com> on behalf of Dali <moh...@fifty-five.com>
Reply-To: "swagger-sw...@googlegroups.com" <swagger-sw...@googlegroups.com>
Date: Wednesday, 28 December 2016 at 5:23
To: Swagger <swagger-sw...@googlegroups.com>
Subject: Re: Can't get swagger.json
I'm using swagger-core 1.5.0
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
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 swagger-swaggers...@googlegroups.com.
compile 'io.swagger:swagger-core:1.5.12'
compile 'io.swagger:swagger-jaxrs:1.5.12'
jerseyServletHolder.setInitParameter(ServerProperties.PROVIDER_PACKAGES,
"com.fiftyfive.services;com.fasterxml.jackson.jaxrs.json;io.swagger.jaxrs.listing");
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
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 swagger-swaggersocket+unsub...@googlegroups.com.
You’d need to check you application logs to see why you’re getting 500. You might need to bump up the log levels.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
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 swagger-swaggers...@googlegroups.com.
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 swagger-swaggers...@googlegroups.com.
INFO 2017-01-02 17:29:50:041 ApiDaoProvider:45 - http://localhost:5003/v1/swagger.json
INFO 2017-01-02 17:29:50:043 ApiDaoProvider:49 - InstanceContextFilter
Jan 02, 2017 5:29:50 PM org.eclipse.jetty.servlet.ServletHandler doHandle
WARNING:
javax.servlet.ServletException: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:717)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:552)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1111)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:479)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1045)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:462)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:279)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:232)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:534)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at java.util.LinkedList.checkElementIndex(LinkedList.java:553)
at java.util.LinkedList.get(LinkedList.java:474)
at java.util.Collections$UnmodifiableList.get(Collections.java:1211)
at com.fiftyfive.services.filters.InstanceContextFilter.filter(InstanceContextFilter.java:54)
at org.glassfish.jersey.server.ContainerFilteringStage.apply(ContainerFilteringStage.java:132)
at org.glassfish.jersey.server.ContainerFilteringStage.apply(ContainerFilteringStage.java:68)
at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:318)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
... 18 more
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
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 swagger-swaggersocket+unsub...@googlegroups.com.
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 swagger-swaggersocket+unsub...@googlegroups.com.
Can you provide a full list of your dependencies?
Here are my logs :
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
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 swagger-swaggers...@googlegroups.com.
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 swagger-swaggers...@googlegroups.com.
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 swagger-swaggers...@googlegroups.com.
all my dependencies on my build.gradle :
dependencies {
compile 'org.slf4j:slf4j-api:1.7.12'
compile 'org.slf4j:slf4j-jdk14:1.7.12'
compile 'org.slf4j:slf4j-log4j12:1.7.12'
compile 'log4j:log4j:1.2.17'
compile 'org.json:json:20090211'
compile 'org.codehaus.jackson:jackson-core-asl:1.9.13'
compile 'com.google.guava:guava:15.0'
compile 'org.glassfish.jersey.core:jersey-server:2.22.2'
compile 'org.glassfish.jersey.core:jersey-client:2.22.2'
compile 'org.glassfish.jersey.containers:jersey-container-servlet:2.22.2'
compile 'org.glassfish.jersey.containers:jersey-container-jetty-servlet:2.22.2'
compile 'org.glassfish.jersey.containers:jersey-container-grizzly2-http:2.22.2'
compile 'org.eclipse.jetty:jetty-server:9.1.6.v20160112'
compile 'org.glassfish.jersey.media:jersey-media-json-jackson:2.22.2'
compile 'org.glassfish.jersey.media:jersey-media-multipart:2.22.2'
compile 'javax.servlet:javax.servlet-api:3.1.0'
compile 'org.apache.commons:commons-email:1.3.3'
compile 'org.mongodb:mongo-java-driver:2.14.1'
compile 'commons-io:commons-io:2.4'
compile 'com.codahale.metrics:metrics-core:3.0.1'
compile 'io.swagger:swagger-core:1.5.12'
compile 'io.swagger:swagger-jaxrs:1.5.12'
testCompile 'org.glassfish.jersey.test-framework:jersey-test-framework-core:2.22.2'
testCompile 'org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-grizzly2:2.22.2'
testCompile 'org.testng:testng:6.8.1'
testCompile 'org.mockito:mockito-all:1.9.5'
Here are my logs :
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
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 swagger-swaggersocket+unsub...@googlegroups.com.
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 swagger-swaggersocket+unsub...@googlegroups.com.
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 swagger-swaggersocket+unsub...@googlegroups.com.
I was referring to the dependencies that are actually downloaded (in case of conflicts and such).
Maven has a way to get a list of that as a command, I’m sure gradle has something similar.
Here are my logs :
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
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 swagger-swaggers...@googlegroups.com.
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 swagger-swaggers...@googlegroups.com.
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 swagger-swaggers...@googlegroups.com.
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 swagger-swaggers...@googlegroups.com.
Here are my logs :
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
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 swagger-swaggersocket+unsub...@googlegroups.com.
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 swagger-swaggersocket+unsub...@googlegroups.com.
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 swagger-swaggersocket+unsub...@googlegroups.com.
resourceConfig.packages("com.fiftyfive.services.apis",
"io.swagger.jaxrs.listing");
ServletContainer servletContainer = new ServletContainer(resourceConfig);