I generated JAX-RS server code for Uber API example in swagger. It is the default Json which can be found by opening http://editor.swagger.io/#/
Now I tried to deploy it in websphere but I see below message:
Error 404: javax.servlet.ServletException: java.io.FileNotFoundException: SRVE0190E: File not found: /v1/swagger.json
<server description="new server">
<!-- Enable features -->
<basicRegistry id="basic" realm="BasicRealm">
<!-- <user name="yourUserName" password="" /> -->
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint"/>
<!-- Automatically expand WAR files and EAR files -->
<webApplication id="swagger-jaxrs-server" location="swagger-jaxrs-server.war" name="swagger-jaxrs-server"/>
This path would almost work:
http://localhost:9080/swagger-jaxrs-server/swagger.json for serving the json file (where swagger-jaxrs-server is the implied context root), though it overlaps with the
@ApplicationPath("/") in the generated war. BUT...
The issue is with the context root.
The swagger.json has
"basePath" : "/v1", but doesn't include anything in the generated classes to change that base path to include the v1, and servlet containers are somewhat limited in how they allocate context roots.
I would suggest tweaking the generated RestApplication so it has
@ApplicationPath("/v1"), in which case
http://localhost:9080/swagger-jaxrs-server/swagger.json would work to retrieve the json, and
http://localhost:9080/swagger-jaxrs-server/v1/products would match the expected REST endpoints.