java - How to deploy Swagger generated JAXRS server code in Websphere -
i generated jax-rs server code uber api example in swagger. default json can found opening http://editor.swagger.io/#/
now tried deploy in websphere see below message:
error 404: javax.servlet.servletexception: java.io.filenotfoundexception: srve0190e: file not found: /v1/swagger.json
when access url: http://localhost:9080/swagger-jaxrs-server/v1/swagger.json
i didn't make changes auto generated code.
i using wlp-javaee7-8.5.5.9
this how server.xml file looks like:
<server description="new server"> <!-- enable features --> <featuremanager> <feature>javaee-7.0</feature> <feature>localconnector-1.0</feature> <feature>apidiscovery-1.0</feature> </featuremanager> <basicregistry id="basic" realm="basicrealm"> <!-- <user name="yourusername" password="" /> --> </basicregistry> <!-- access server remote client add host attribute following element, e.g. host="*" --> <httpendpoint httpport="9080" httpsport="9443" id="defaulthttpendpoint"/> <!-- automatically expand war files , ear files --> <applicationmanager autoexpand="true"/> <applicationmonitor updatetrigger="mbean"/> <webapplication id="swagger-jaxrs-server" location="swagger-jaxrs-server.war" name="swagger-jaxrs-server"/>
can point missing here.
update:1
this url working fine: http://localhost:8080/swagger-jaxrs-server/swagger.json. part of json :
so, tried below 2 urls.. both didn't work.
http://localhost:8080/swagger-jaxrs-server/estimates/price http://localhost:8080/swagger-jaxrs-server/v1/estimates/price
i don't see web.xml autogenerated code.
this path work: http://localhost:9080/swagger-jaxrs-server/swagger.json
serving json file (where swagger-jaxrs-server implied context root), though overlaps @applicationpath("/")
in generated war. but...
the issue context root.
the swagger.json has "basepath" : "/v1"
, doesn't include in generated classes change base path include v1, , servlet containers limited in how allocate context roots.
i suggest tweaking generated restapplication has @applicationpath("/v1")
, in case http://localhost:9080/swagger-jaxrs-server/swagger.json
work retrieve json, , http://localhost:9080/swagger-jaxrs-server/v1/products
match expected rest endpoints.
Comments
Post a Comment