SlideShare a Scribd company logo
OSGi in Java EE servers: sneak peek inside

Krasimir Semerdzhiev (SAP AG)
EclipseCon Europe 2012




                                   Pictures: Woodland Park Zoo
Why care at all?


Most common application scenarios:
 Reuse open-source components:
    more than 80% percent of enterprises embed open source components in software /Source: SonaType/
     Eclipse ones are (typically) OSGIfied
     Apache/GitHub/GoogleCode/SourceForge/etc mostly have no OSGi packaging

 Modularize/”OSGIfy” Java EE applications
 Getting rid of proprietary module systems in favor of standard one(s). Anyone?
 Software refactoring and evolution




© 2011 SAP AG. All rights reserved.                                                                    2
General approach – That’s our starting point!




© 2011 SAP AG. All rights reserved.             3
General approach – How to eat an elephant?




      Java EE monolithic app

              Libraries in:
              lib
              META-INFlib
              WEB-INFlib




               Java EE container




© 2011 SAP AG. All rights reserved.          4
General approach – Peter Kriens: One piece at a time!




      Java EE monolithic app              Java Web Bundle


              Libraries in:
              lib                            Shared libraries
              WEB-INFlib




               Java EE container
                                      OSGi-enabled Java EE container




© 2011 SAP AG. All rights reserved.                                    5
General approach – Peter Kriens: One piece at a time!




      Java EE monolithic app                   Java Web Bundle


              Libraries in:                       Shared libraries
              lib
              WEB-INFlib


                                      OSGi       OSGi          OSGi     OSGi
                                      bundle     bundle        bundle   bundle

               Java EE container
                                        OSGi-enabled Java EE container




© 2011 SAP AG. All rights reserved.                                              6
General approach – Peter Kriens: One piece at a time!




      Java EE monolithic app              Java Web
                                           Bundle
                                                                  OSGi bundle
              Libraries in:               Shared Libraries
              lib
              WEB-INFlib
                                                                  OSGi bundle

                                      OSGi        OSGi       OSGi       OSGi
                                      bundle      bundle     bundle     bundle

               Java EE container
                                        OSGi-enabled Java EE container




© 2011 SAP AG. All rights reserved.                                              7
General approach – Peter Kriens: One piece at a time!


                                      Projects typically
                                        stop at that
                                           state…


      Java EE monolithic app                               Web Bundle
                                                            Shared Libraries




                                                                                OSGi bundle
                                                                                              OSGi bundle
              Libraries in:
              lib
              WEB-INFlib                                    OSGi bundle
                                                                                              OSGi bundle

                                                           OSGi        OSGi              OSGi       OSGi
                                                           bundle      bundle            bundle     bundle

               Java EE container
                                                             OSGi-enabled Java EE container




© 2011 SAP AG. All rights reserved.                                                                          8
General approach – Peter Kriens: One piece at a time!

                                      Very unlikely to
                                      reach this state!
                                        Don’t worry!
                                        That’s OK!
                                                                    Java Web Bundle
      Java EE monolithic app
                                                          OSGi       OSGi




                                                                              OSGi bundle
                                                          bundle     bundle
                                                                                            OSGi bundle
              Libraries in:
              lib
              WEB-INFlib                                   OSGi bundle
                                                                                            OSGi bundle

                                                          OSGi       OSGi              OSGi       OSGi
                                                          bundle     bundle            bundle     bundle

               Java EE container
                                                            OSGi-enabled Java EE container




© 2011 SAP AG. All rights reserved.                                                                        9
General approach – Keep the goal in sight!


It’s not for those reasons:
 Single bundle can’t be reliably stopped!                Java Web Bundle

 Single bundle can’t be reliably updated!      OSGi       OSGi




                                                                    OSGi bundle
                                                bundle     bundle
 Reference caching further spoils the party!                                     OSGi bundle


 Random startup order as a surprise for non-      OSGi bundle
                                                                                  OSGi bundle
  aware modules.
                                                OSGi       OSGi              OSGi       OSGi
 Reference resolution for naïve package        bundle     bundle            bundle     bundle

  imports without a version might become
  tricky.                                         OSGi-enabled Java EE container




© 2011 SAP AG. All rights reserved.                                                              10
We go for OSGi - which server to run on?

Java EE 6 compatibility page (23.Oct.2012)
Java EE 6 Web                          Java EE 6 Full profile
profile




 © 2011 SAP AG. All rights reserved.                            11
Tested scenario: Granny’s address book


                                          Spring
                                         Spring
       Granny’s                       Spring (14)
       address
        book                             slf4j        dom4j

                                         log4j        Guava

                                       javassist    Tomcat jdbc

                                      hibernate     Apache juli

                                         cglib         asm

                                      aopalliance      antlr


      Source: Original sources + packaging on GitHub




© 2011 SAP AG. All rights reserved.                               12
Apache TomEE 1.0


OSGi support
 None whatsoever
     Neither uses, nor provides any

   Modularity: none – stick to Tomcat webapps
     Libs can be put in [tomeelib] folder
     No activators/resolution. Works like classpath.

Overall experience
 Feels very lightweight even with a bigger WAR file.
 TomEE doesn’t currently support web.xml <resource-ref> definitions in web.xml.
  To be fixed soon.
 Doing partial application update is not supported by the server. Requires 3-rd
  party tools like LiveRebel for example.

© 2011 SAP AG. All rights reserved.                                                13
Caucho Resin 4.0.32 free


OSGi support
 None whatsoever (but Why OSGi is cool, but not for enterprise apps blog)
   Modularity: Own “pomegranate” module system, dependencies in pom.xml
     Additional JARs can be put in [resinext-lib] folder
     No activators/resolution. Works like classpath.

Overall experience
 Easy to handle
 No default datasource is bound in JNDI. Therefore app startup fails if not created
  manually.




© 2011 SAP AG. All rights reserved.                                               14
JBoss Application Server 7(web)


OSGi support
 JBoss own OSGI impl.
     Tutorial available over here

   Additional bundles handling
     Transform the WAR as a Web Bundle Archive (WAB) JAR.
     Add the WAB + all related bundles in standalonedeployment “auto-deploy” folder

Overall experience
 Easy to use! A bit hard to find the application web alias…
 Both web console + CLI admin deploy only single archives. No batching.
 Deployment passes successfully although bundles can’t be resolved at that time.
 Startup fails silently afterwards.

© 2011 SAP AG. All rights reserved.                                                     15
Glassfish 3.1.2.2 (web + full)


OSGi support
 HK2 is based on Apache Felix
   Additional bundles handling
     Deploy bundles one by one via asadmin CLI tool.

Overall experience
 Deploy fails correctly on failed resolution. Have to handy-pick all dependencies
  one by one.
 Web console seems to cautiously ignore OSGi :-)




© 2011 SAP AG. All rights reserved.                                                  16
Apache Geronimo 3.0


OSGi support
 Based on Apache Felix
   Additional bundles handling
     Deployment via the Eclipse development tools

Overall experience
 Build as both Web Profile and Full Profile, but never cared to certify against the
  Web Profile




© 2011 SAP AG. All rights reserved.                                                    17
Other projects to watch out for




WebSphere Application Server V8.5 Liberty Profile

Eclipse Virgo




© 2011 SAP AG. All rights reserved.                 18
You still want to take the journey?


Take a look at @glynnormington “Is OSGi modularity always worth it?”
session.

Management is very susceptive to “costs” and “ROI” arguments.

Make the cost calculations carefully and use the numbers wisely!




© 2011 SAP AG. All rights reserved.                                    19
Thank You!
krasimir.semerdzhiev@sap.com




                               Pictures: Woo

More Related Content

PDF
OSGi & Java EE in GlassFish - Best of both worlds
PDF
Modular EJBs in OSGi - Tim Ward
PPTX
Java Modularity with OSGi
PDF
Weld-OSGi, injecting easiness in OSGi
PDF
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
PDF
Building Content Applications with JCR and OSGi
PDF
OSGi and Java EE in GlassFish - Tech Days 2010 India
PDF
RESTful Services and Distributed OSGi - 04/2009
OSGi & Java EE in GlassFish - Best of both worlds
Modular EJBs in OSGi - Tim Ward
Java Modularity with OSGi
Weld-OSGi, injecting easiness in OSGi
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
Building Content Applications with JCR and OSGi
OSGi and Java EE in GlassFish - Tech Days 2010 India
RESTful Services and Distributed OSGi - 04/2009

What's hot (7)

PDF
Use Case: Building OSGi Enterprise Applications (QCon 14)
PDF
OGF Cloud Standards: Current status and ongoing interoperability efforts wi...
PDF
Embrace Change - Embrace OSGi
PDF
OSGi enRoute Unveiled - P Kriens
PDF
Benefits of OSGi in Practise
PDF
Lessons learned from a large scale OSGii web app - P Bakker & J de Vreede
PDF
CDI Integration in OSGi - Emily Jiang
Use Case: Building OSGi Enterprise Applications (QCon 14)
OGF Cloud Standards: Current status and ongoing interoperability efforts wi...
Embrace Change - Embrace OSGi
OSGi enRoute Unveiled - P Kriens
Benefits of OSGi in Practise
Lessons learned from a large scale OSGii web app - P Bakker & J de Vreede
CDI Integration in OSGi - Emily Jiang
Ad

Similar to OSGI in Java EE servers:Sneak peak (20)

PDF
OSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir Semerdzhiev
PDF
Modular Java EE in the Cloud
PDF
modular-ejbs-for-enterprise-osgi developers
PDF
OSGi Community Updates 2012
ODP
Java EE | Modular EJBs for Enterprise OSGi | Tim Ward
PDF
Nuxeo World Session: Nuxeo & OSGi
PDF
Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph! ...
PDF
Developing modular applications with Java EE 6 and Enterprise OSGi + WebSpher...
PDF
The OSGi Framework Multiplication
PPTX
OSGi summary
PDF
GlassFish OSGi - Java2days 2010
PDF
Enterprise OSGi at eBay
PDF
Jax london 2011
PDF
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
PDF
Libra - New Tools at Eclipse for OSGi Enterprise Development
PDF
OSGi and Java EE: A Hybrid Approach to Enterprise Java Application Development
PDF
Maven tools - Stuart McCulloch, V.P. OSGi, Jayway Malaysia
PDF
OSGi for mere mortals
PDF
Creating Large Scale Software Platforms with OSGi and an Extension Point Mode...
PDF
Concierge - Bringing OSGi (back) to Embedded Devices
OSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir Semerdzhiev
Modular Java EE in the Cloud
modular-ejbs-for-enterprise-osgi developers
OSGi Community Updates 2012
Java EE | Modular EJBs for Enterprise OSGi | Tim Ward
Nuxeo World Session: Nuxeo & OSGi
Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph! ...
Developing modular applications with Java EE 6 and Enterprise OSGi + WebSpher...
The OSGi Framework Multiplication
OSGi summary
GlassFish OSGi - Java2days 2010
Enterprise OSGi at eBay
Jax london 2011
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Libra - New Tools at Eclipse for OSGi Enterprise Development
OSGi and Java EE: A Hybrid Approach to Enterprise Java Application Development
Maven tools - Stuart McCulloch, V.P. OSGi, Jayway Malaysia
OSGi for mere mortals
Creating Large Scale Software Platforms with OSGi and an Extension Point Mode...
Concierge - Bringing OSGi (back) to Embedded Devices
Ad

More from SAP HANA Cloud Platform (17)

PDF
SAP Hack2Build hackathon - SAP Commerce Cloud & Kyma runtime
PDF
Gardener: Managed Kubernetes on Your Terms
PDF
Kyma: Extending Business systems with Kubernetes, Istio and <fill the blank>.
PDF
Using Kubernetes to Extend Enterprise Software
PDF
Kubernetes, Istio and Knative - noteworthy practical experience
PDF
Options for running Kubernetes at scale across multiple cloud providers
PDF
SAP DKOM 2016 | 30154 | SAP HCP Cloud Extensions Intro
PDF
SAP TechEd 2015 | DEV109 | Extending Cloud Solutions from SAP using SAP HANA ...
PDF
SAP D-Code/TechEd 2014|DEV203|Extending SuccessFactors using SAP HANA Cloud P...
PDF
SAP TechEd 2013: CD105: Extending SuccessFactors EmployeeCentral with apps on...
PDF
SAP HANA Cloud Platform Community BOF @ Devoxx 2013
PDF
SAP HANA Cloud Platform: The void between your Datacenter and the Cloud
PDF
SAP HANA Cloud: From Your Datacenter to the Cloud and Back
PDF
[BGOUG] Memory analyzer
PDF
[BGOUG] Java GC - Friend or Foe
PDF
JavaOne 2010: OSGI Migrat
PDF
Eclipse Open Source @ SAP
SAP Hack2Build hackathon - SAP Commerce Cloud & Kyma runtime
Gardener: Managed Kubernetes on Your Terms
Kyma: Extending Business systems with Kubernetes, Istio and <fill the blank>.
Using Kubernetes to Extend Enterprise Software
Kubernetes, Istio and Knative - noteworthy practical experience
Options for running Kubernetes at scale across multiple cloud providers
SAP DKOM 2016 | 30154 | SAP HCP Cloud Extensions Intro
SAP TechEd 2015 | DEV109 | Extending Cloud Solutions from SAP using SAP HANA ...
SAP D-Code/TechEd 2014|DEV203|Extending SuccessFactors using SAP HANA Cloud P...
SAP TechEd 2013: CD105: Extending SuccessFactors EmployeeCentral with apps on...
SAP HANA Cloud Platform Community BOF @ Devoxx 2013
SAP HANA Cloud Platform: The void between your Datacenter and the Cloud
SAP HANA Cloud: From Your Datacenter to the Cloud and Back
[BGOUG] Memory analyzer
[BGOUG] Java GC - Friend or Foe
JavaOne 2010: OSGI Migrat
Eclipse Open Source @ SAP

Recently uploaded (20)

PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Approach and Philosophy of On baking technology
PDF
cuic standard and advanced reporting.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Big Data Technologies - Introduction.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
KodekX | Application Modernization Development
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
Programs and apps: productivity, graphics, security and other tools
Diabetes mellitus diagnosis method based random forest with bat algorithm
Approach and Philosophy of On baking technology
cuic standard and advanced reporting.pdf
The AUB Centre for AI in Media Proposal.docx
20250228 LYD VKU AI Blended-Learning.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
“AI and Expert System Decision Support & Business Intelligence Systems”
The Rise and Fall of 3GPP – Time for a Sabbatical?
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Big Data Technologies - Introduction.pptx
MIND Revenue Release Quarter 2 2025 Press Release
KodekX | Application Modernization Development
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation

OSGI in Java EE servers:Sneak peak

  • 1. OSGi in Java EE servers: sneak peek inside Krasimir Semerdzhiev (SAP AG) EclipseCon Europe 2012 Pictures: Woodland Park Zoo
  • 2. Why care at all? Most common application scenarios:  Reuse open-source components: more than 80% percent of enterprises embed open source components in software /Source: SonaType/  Eclipse ones are (typically) OSGIfied  Apache/GitHub/GoogleCode/SourceForge/etc mostly have no OSGi packaging  Modularize/”OSGIfy” Java EE applications  Getting rid of proprietary module systems in favor of standard one(s). Anyone?  Software refactoring and evolution © 2011 SAP AG. All rights reserved. 2
  • 3. General approach – That’s our starting point! © 2011 SAP AG. All rights reserved. 3
  • 4. General approach – How to eat an elephant? Java EE monolithic app Libraries in: lib META-INFlib WEB-INFlib Java EE container © 2011 SAP AG. All rights reserved. 4
  • 5. General approach – Peter Kriens: One piece at a time! Java EE monolithic app Java Web Bundle Libraries in: lib Shared libraries WEB-INFlib Java EE container OSGi-enabled Java EE container © 2011 SAP AG. All rights reserved. 5
  • 6. General approach – Peter Kriens: One piece at a time! Java EE monolithic app Java Web Bundle Libraries in: Shared libraries lib WEB-INFlib OSGi OSGi OSGi OSGi bundle bundle bundle bundle Java EE container OSGi-enabled Java EE container © 2011 SAP AG. All rights reserved. 6
  • 7. General approach – Peter Kriens: One piece at a time! Java EE monolithic app Java Web Bundle OSGi bundle Libraries in: Shared Libraries lib WEB-INFlib OSGi bundle OSGi OSGi OSGi OSGi bundle bundle bundle bundle Java EE container OSGi-enabled Java EE container © 2011 SAP AG. All rights reserved. 7
  • 8. General approach – Peter Kriens: One piece at a time! Projects typically stop at that state… Java EE monolithic app Web Bundle Shared Libraries OSGi bundle OSGi bundle Libraries in: lib WEB-INFlib OSGi bundle OSGi bundle OSGi OSGi OSGi OSGi bundle bundle bundle bundle Java EE container OSGi-enabled Java EE container © 2011 SAP AG. All rights reserved. 8
  • 9. General approach – Peter Kriens: One piece at a time! Very unlikely to reach this state! Don’t worry! That’s OK! Java Web Bundle Java EE monolithic app OSGi OSGi OSGi bundle bundle bundle OSGi bundle Libraries in: lib WEB-INFlib OSGi bundle OSGi bundle OSGi OSGi OSGi OSGi bundle bundle bundle bundle Java EE container OSGi-enabled Java EE container © 2011 SAP AG. All rights reserved. 9
  • 10. General approach – Keep the goal in sight! It’s not for those reasons:  Single bundle can’t be reliably stopped! Java Web Bundle  Single bundle can’t be reliably updated! OSGi OSGi OSGi bundle bundle bundle  Reference caching further spoils the party! OSGi bundle  Random startup order as a surprise for non- OSGi bundle OSGi bundle aware modules. OSGi OSGi OSGi OSGi  Reference resolution for naïve package bundle bundle bundle bundle imports without a version might become tricky. OSGi-enabled Java EE container © 2011 SAP AG. All rights reserved. 10
  • 11. We go for OSGi - which server to run on? Java EE 6 compatibility page (23.Oct.2012) Java EE 6 Web Java EE 6 Full profile profile © 2011 SAP AG. All rights reserved. 11
  • 12. Tested scenario: Granny’s address book Spring Spring Granny’s Spring (14) address book slf4j dom4j log4j Guava javassist Tomcat jdbc hibernate Apache juli cglib asm aopalliance antlr Source: Original sources + packaging on GitHub © 2011 SAP AG. All rights reserved. 12
  • 13. Apache TomEE 1.0 OSGi support  None whatsoever  Neither uses, nor provides any  Modularity: none – stick to Tomcat webapps  Libs can be put in [tomeelib] folder  No activators/resolution. Works like classpath. Overall experience  Feels very lightweight even with a bigger WAR file.  TomEE doesn’t currently support web.xml <resource-ref> definitions in web.xml. To be fixed soon.  Doing partial application update is not supported by the server. Requires 3-rd party tools like LiveRebel for example. © 2011 SAP AG. All rights reserved. 13
  • 14. Caucho Resin 4.0.32 free OSGi support  None whatsoever (but Why OSGi is cool, but not for enterprise apps blog)  Modularity: Own “pomegranate” module system, dependencies in pom.xml  Additional JARs can be put in [resinext-lib] folder  No activators/resolution. Works like classpath. Overall experience  Easy to handle  No default datasource is bound in JNDI. Therefore app startup fails if not created manually. © 2011 SAP AG. All rights reserved. 14
  • 15. JBoss Application Server 7(web) OSGi support  JBoss own OSGI impl.  Tutorial available over here  Additional bundles handling  Transform the WAR as a Web Bundle Archive (WAB) JAR.  Add the WAB + all related bundles in standalonedeployment “auto-deploy” folder Overall experience  Easy to use! A bit hard to find the application web alias…  Both web console + CLI admin deploy only single archives. No batching.  Deployment passes successfully although bundles can’t be resolved at that time.  Startup fails silently afterwards. © 2011 SAP AG. All rights reserved. 15
  • 16. Glassfish 3.1.2.2 (web + full) OSGi support  HK2 is based on Apache Felix  Additional bundles handling  Deploy bundles one by one via asadmin CLI tool. Overall experience  Deploy fails correctly on failed resolution. Have to handy-pick all dependencies one by one.  Web console seems to cautiously ignore OSGi :-) © 2011 SAP AG. All rights reserved. 16
  • 17. Apache Geronimo 3.0 OSGi support  Based on Apache Felix  Additional bundles handling  Deployment via the Eclipse development tools Overall experience  Build as both Web Profile and Full Profile, but never cared to certify against the Web Profile © 2011 SAP AG. All rights reserved. 17
  • 18. Other projects to watch out for WebSphere Application Server V8.5 Liberty Profile Eclipse Virgo © 2011 SAP AG. All rights reserved. 18
  • 19. You still want to take the journey? Take a look at @glynnormington “Is OSGi modularity always worth it?” session. Management is very susceptive to “costs” and “ROI” arguments. Make the cost calculations carefully and use the numbers wisely! © 2011 SAP AG. All rights reserved. 19