Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

OSGI alternative

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is nightmare to use OSGI with all of it's bundle installation/loading issues and classnotfound issue. Is there any alternative for it ?
 
Saloon Keeper
Posts: 5867
147
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OSGi is non-trivial for sure, but worth its learning curve IMO. To advise on alternatives, you need to tell us what you intended to use it for.
 
Ranch Hand
Posts: 10191
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The alternative is not to use it!

We have moved away from OSGi and our application suite is composed of a set of Microservices, containerised in Docker! We are now in the process of introducing some container management tool that would enable us to orchestrate Docker containers!
 
Saloon Keeper
Posts: 10750
229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe, how does Docker replace what OSGi does?
 
Saloon Keeper
Posts: 21240
137
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't.

OSGi is a framework similar to how web application servers work, except that the services may not be web-based or even networking-based. It essentially allows a JVM to be partitioned up into different application spaces with unique and non-conflicting classpaths and allows modules to interconnect without physically binding them into a single execution unit. Because of the built-in classpath isolation, OSGi has, in fact been used as the framework to implement web application servers.

Containers are miniature VMs, running discrete programs, which may or may not be Java programs. While some Java applications could at the designer's option be either OSGi or stand-alone apps containerize, Docker containers have much more OS resource overhead, even though less than a full VM would. In fact, even running multiple JVMs, one per app natively is going to have a lot more resource overhead than one JVM hosting multiple lightweight OSGi apps.

If an app is so critical that living in an OSGi container is undesirable and you'd prefer that it run stand-alone, with the real-time cross-machine portability that containers support, then by all means Dockerize it. But my OSGi server (Apache ServiceMix) itself runs as a Docker container.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java 9 is going to have its own module system (Java 9 is not out yet at this moment, so you can't really use it yet).

It will have some of the same features as OSGi, but it won't be able to dynamically start / stop and replace modules like OSGi does.
 
Stephan van Hulst
Saloon Keeper
Posts: 10750
229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't really understand the concept of using Docker together with Java. To me it appears that Docker containers are like lightweight VMs so applications can easily run cross-platform. Isn't this already the whole idea behind the JVM itself?

I also don't understand how any of these features address Swapna's original question. OSGi is a framework for plugging in modules dynamically as far as I understand it, and it appears Swapna would like another framework that does this more easily. The only thing I can think of is something like NetBeans Platform Module System, although it's not necessarily easier than OSGi.

I'm sure I'm completely misunderstanding Joe's suggestion, but I'm eager to learn more about these technologies.
 
Tim Holloway
Saloon Keeper
Posts: 21240
137
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JVM-based apps are not self-contained. To run the Tomcat webapp server, for example, you have to have 2 separate directory structures for the server itself (although by default they overlap). Plus whatever additional OS resources the webapps themselves may tap into.

So it's much more convenient to containerize the whole ball of wax except for maybe a few external resources. That way you can easily spin up multiple copies and/or bounce instances from one container server to another for load balancing and business continuity purposes. Accordingly, I have Docker JVMs for ServiceMix, Jenkins, Nexus, and several webservers.

I worked with a precursor to OSGi and it was no picnic. If OSGi seems complex, it's because it's also capable. But with the right build resources you can do a lot towards taming it.

Actually, if you want modularity without OSGi, most people would probably start with the Spring Framework.

Although Spring itself supports OSGi.
 
Stephan van Hulst
Saloon Keeper
Posts: 10750
229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting, thanks Tim! I'll check it out a bit more.

Sorry if I hijacked your thread Swapna, I hope you managed to get some answers?
 
Attractive, successful people love this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!