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 Video Library
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
View Events Video Library
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
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

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • How To Get and Set PDF Form Fields in Java
  • The API-Centric Revolution: Decoding Data Integration in the Age of Microservices and Cloud Computing
  • API Design
  • A Better Web3 Experience: Account Abstraction From Flow (Part 2)

Trending

  • Agile Estimation: Techniques and Tips for Success
  • Monkey-Patching in Java
  • Software Verification and Validation With Simple Examples
  • Build a Serverless App Fast With Zipper: Write TypeScript, Offload Everything Else
  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.72K 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.

Related

  • How To Get and Set PDF Form Fields in Java
  • The API-Centric Revolution: Decoding Data Integration in the Age of Microservices and Cloud Computing
  • API Design
  • A Better Web3 Experience: Account Abstraction From Flow (Part 2)

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

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: