swagger.json not generated in Websphere 8.5

901 views
Skip to first unread message

Rohit s

unread,
Nov 24, 2015, 5:44:31 AM11/24/15
to Swagger
Hi,
 
I am trying to get the swagger api for documentation enabled on my project but having some trouble with this.
When I deploy on tomcat the swagger json is generated and the documentation is shown in  swagger UI.
But when I deploy the same project to Websphere , a cant read swagger.json error is generated.
 
I also tried deploying one of the sample projects java-jersey-jaxrs available at http://swagger.io.
this project also works on tomcat but fails on WAS 8.5. The errors are the same
 
Below is the tool stack we are using
 
jersey 1.19
WAS 8.5
swagger 1.5.3
 
Please provide any advice if possible
 
Regards,
Rohit

tony tam

unread,
Nov 27, 2015, 9:20:08 PM11/27/15
to Swagger
Hi, you'll have to give more details if you want help with this.

Rohit s

unread,
Dec 1, 2015, 8:33:41 AM12/1/15
to Swagger
Hi,

We  downloaded the swagger sample java projects from the Swagger Site.We are trying to work with the java-jaxrs sample project.

This project works on Tomcat and the swagger documentation shows up. But when the same project is deployed in websphere the swagger UI is shown but 
we get an error called cant read swagger,json. 

Is there a known error  for Swagger not working on Websphere. We are using WAS 8.5. We used tomcat 7 for our testing.




Regards,
Rohit

Rohit s

unread,
Dec 1, 2015, 8:46:49 AM12/1/15
to Swagger
Hi,

We have loooked at a lot of posts on swagger. The issue seems to be that the swagger.json is not generated in WAS. but it is generated 
at the same url in TOMCAT. We are also not seeing any errors in the server logs in Websphere.



Regards

Ron

unread,
Dec 1, 2015, 1:21:15 PM12/1/15
to Swagger
I'm afraid that's still not enough details. Are you getting 404? Something else?
Which URL do you use?
How is your application configured?

Rohit s

unread,
Dec 2, 2015, 12:47:06 PM12/2/15
to Swagger


On Tuesday, 1 December 2015 23:51:15 UTC+5:30, Ron wrote:
I'm afraid that's still not enough details. Are you getting 404? Something else?
Which URL do you use?
How is your application configured?
Hi,

We are getting a 404 error when we try to get the Swagger.json.The Swagger UI is just blank.
 We are not able to share the application configuration due to client security protocols.
We are getting the same error using the swagger sample projects and have shared the configuration for the same. 
Please let us know what is the exact information needed .
Have attached the Screenshot of the Swagger UI as seen in Tomcat, Websphere and the web.xml of the sample project that we used for our testing.
TomcatScreenshot.png
WebsphereScreenshot.png
web.xml

Ron

unread,
Dec 2, 2015, 6:05:19 PM12/2/15
to Swagger
Which URL do you use to access the swagger.json?
Have you checked that the API itself works? If so, can you give a sample URL that works?
Do you see anything in your logs?

Rohit s

unread,
Dec 3, 2015, 6:41:04 AM12/3/15
to Swagger
On Tomcat the Web Application is deployed at http://localhost:8080/swagger-java-sample-app-1.0.0
ON websphere we set a context of /sample so the end URL is http://localhost:9082/sample
The API itself does not seem to work on Websphere

For Websphere the URL we checked was http://localhost:9082/sample/api/swagger.json which would be the method
for checking on Websphere. We also checked on various other combinations of the URL to check if the swagger.json is generated 
at some other endpoint.
We do not see anything in the logs.

Ron

unread,
Dec 3, 2015, 1:31:53 PM12/3/15
to Swagger
If the API itself doesn't work, then you need to look into that first. I'm afraid that's something I can't help you with. If your API isn't accessible, the swagger.json would not be accessible either as it is in fact an API call.

Rohit s

unread,
Dec 3, 2015, 1:46:01 PM12/3/15
to Swagger
Hi,

The Rest Webservices are available. I misunderstood. The Rest Ws work both on Tomcat and Websphere. The Swagger UI too shows up.
It is the Swagger.json that is not generated. 
Regards,
Rohit

Rohit s

unread,
Dec 7, 2015, 3:45:22 PM12/7/15
to Swagger
Hi,

By Enabling the logging for the io.swagger classes we were able to generate logs for swagger. We can now see some errors occurring due to swagger API in Websphere.
A few jars related to jersey may be missing from our application. 
As we now know the issues that are occurring we hope to be able to get swagger working by solving these issues.
Thanks for all your help and guidance in resolving this issue.

Regards,
Rohit

Ron

unread,
Dec 7, 2015, 5:54:43 PM12/7/15
to Swagger
Thanks for the update. Please let us know if you need anything else.
Message has been deleted

Parag Lohiya

unread,
Dec 21, 2015, 6:14:12 PM12/21/15
to Swagger
Hi Rohit,

I am facing the same exact issue. could you please let me know what was the fix.
we use websphere 8.0.0.5 and jersey 6.

Rohit s

unread,
Dec 25, 2015, 5:31:34 AM12/25/15
to Swagger
Parag,

Do not have a resolution on this. Still working on it.

Regards,
Rohit

Rohit s

unread,
Jan 4, 2016, 8:52:19 AM1/4/16
to Swagger
Parag,
 
I am not working on this issue anymore. Wasnt able to resolve this . You could follow Ron advice to reach a solution
 
Regards,
Rohit

Parag Lohiya

unread,
Jan 26, 2016, 8:55:46 PM1/26/16
to Swagger
Hi Ron,

I have deployed the application on Websphere 8.5.x (liberty) javaee 6 stack. When I run the same application on Tomcat 7 it works fine. swagger.json file is generated successfully and this has helped my team a lot. But after deployment on dev server I get below error. I did some googling and found that this happens because of two jax-rs version in project but then I did dependency tree and used https://www.ricston.com/blog/jar-hell/ link to found overlap jar it doesn't show any conflict. The error as you see is getting originated from ApifilterOrigin class which is used by swagger.

I am getting below exception.
[ERROR   ] SRVE0271E: Uncaught init() exception created by servlet [jersey-servlet] in application [rmds_app_ear_ear_exploded]: java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:303)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:284)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:311)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:168)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358)
at javax.servlet.GenericServlet.init(GenericServlet.java:161)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:332)
at [internal classes]
at com.marriott.revenue.dataservice.web.filter.ApiOriginFilter.doFilter(ApiOriginFilter.java:37)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207)
at [internal classes]
Reply all
Reply to author
Forward
0 new messages