DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Data Engineering
  3. Databases
  4. Ask DZ: Swagger API on Multiple OSGI Bundles Using Apache Karaf

Ask DZ: Swagger API on Multiple OSGI Bundles Using Apache Karaf

This author is having an issue with a possible caching issue dealing with Swagger's api-docs. Think you may know a solution to his conundrum? Leave a comment!

Umang Modi user avatar by
Umang Modi
·
Jun. 22, 16 · Analysis
Like (2)
Save
Tweet
Share
4.54K Views

Join the DZone community and get the full member experience.

Join For Free

I have created Java RESTful web services using Apache Karaf, using Swagger for API documentation. All annotations are applied, and it's running successfully on a single OSGI bundle with the general Swagger configuration (Swagger core and the annotations JAR) with Apache Karaf on standalone mode.

Issue

While running Swagger on multiple OSGI bundles, it is catching the result generated while hitting "/api-docs" on the very first WSDL, and it returns the same for other WSDL's as well.

Description

Let's say I have two web services exposed as below:

  1. "http:/localhost:8181/cxf/abc?_wadl"

  2. "http:/localhost:8181/cxf/xyz?_wadl"

The web services are exposed on two different OSGI bundles and all the configurations are written in their respective "bluprint.xml" files. The Swagger Core and Swagger annotations dependencies are located in each project's pom.xml.

When I run Swagger API on the first WSDL:

"http:/localhost:8181/cxf/abc/api-docs"

it returns the result successfully, but on hitting Swagger on the second WSDL:

"http:/localhost:8181/cxf/xyz/api-docs"

it returned the same result, which was initially produced by the first WSDL. It cached the first WSDL JSON somewhere and always returns the initial result.

My Questions

  1. Is there any other way to run the Swagger API on Multiple OSGI bundles using Apache Karaf?

  2. Is there any way we can permanently disable the caching using this Karaf/Swagger configuration?

  3. Is there any method to clear the Swagger cache (which got created when I made a hit to http:/localhost:8181/cxf/abc/api-docs) when hitting Swagger for the next OSGI bundles (http:/localhost:8181/cxf/xyz/api-docs), so it rescans the API annotations and doesn't return the cached result?

Note: I have implemented the Swagger API on OSGI bundles using: https://github.com/ddragosd/jax-rs-on-karaf

API

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Introduction to Spring Cloud Kubernetes
  • DevOps for Developers: Continuous Integration, GitHub Actions, and Sonar Cloud
  • mTLS Everywere
  • Stop Using Spring Profiles Per Environment

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: