Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Embedding OSGi Framework in Kotlin Server Project for Dynamic Module Loading (Embedding and Dynamically Loading OSGi Modules in Kotlin Server Project)
Embedding OSGi Framework in Kotlin Server Project for Dynamic Module Loading [message #1860044] Thu, 13 July 2023 12:51 Go to next message
Nir Yudovitz is currently offline Nir YudovitzFriend
Messages: 1
Registered: July 2023
Junior Member
Hello everyone,

I'm working on a server project written in Kotlin where I need to dynamically load and unload modules during runtime.
I'd like to leverage the OSGi framework for this purpose. However, I'm new to OSGi and would appreciate some guidance on how to approach this.

Specifically, I have the following requirements and questions:

1. Is it possible to embed the OSGi framework within my Kotlin server project?
2. Are there any specific considerations or best practices when using OSGi with Kotlin/java?
3. What are the recommended steps for dynamically loading and unloading OSGi (If it matters, ideally, they will be stored on S3)?
4. Is there any sample code or a tutorial available that demonstrates a similar setup with Kotlin/java and OSGi integration?

If needed, I can provide a code example of a simple Proof of Concept (POC) that I attempted using the Apache Felix library but encountered issues.

Thank you in advance for your assistance and guidance.

Nir Yudovitz
Re: Embedding OSGi Framework in Kotlin Server Project for Dynamic Module Loading [message #1861080 is a reply to message #1860044] Tue, 19 September 2023 07:47 Go to previous message
Giorgio NunziFriend
Messages: 3
Registered: February 2020
Junior Member
Hi, I am not expert, but I just came across this andI try to help.

You don't embed OSGi in your server, you actually do the other way around: your server will be an OSGi bundle.

You need an OSGi implementation, Equinox or Felix, and add the Kotlin bundle to it as dependency.
See https://sites.google.com/a/athaydes.com/renato-athaydes/posts/osgi-runtutorial-runyourjavakotlinfregecodeinosgi as an example, at the very bottom.

Finally, you need to create an OSGi Component to register your server as an OSGI Service (activate/deactivate methods etc.) There are pleny of examples our there.

PS: Note that the page above uses Gradle, but actually Maven is mostly used to compile Equinox or Felix.
Previous Topic:xmi to plugin
Next Topic:Howto Close a Window (using a tiling windows manager)
Goto Forum:
  


Current Time: Sun Apr 28 17:47:14 GMT 2024

Powered by FUDForum. Page generated in 0.07713 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top