Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
OSGi in Java EE servers: sneak peek inside
Krasimir Semerdzhiev (SAP AG)
EclipseCon Europe 2012
Pictures: Woodland Park Zoo
© 2011 SAP AG. All rights reserved. 2
Why care at all?
Most common application scenarios:
 Reuse open-source components:
...
© 2011 SAP AG. All rights reserved. 3
General approach – That’s our starting point!
© 2011 SAP AG. All rights reserved. 4
General approach – How to eat an elephant?
Java EE monolithic app
Java EE container
...
© 2011 SAP AG. All rights reserved. 5
General approach – Peter Kriens: One piece at a time!
Java EE monolithic app
Java EE...
© 2011 SAP AG. All rights reserved. 6
General approach – Peter Kriens: One piece at a time!
Java EE monolithic app
Java EE...
© 2011 SAP AG. All rights reserved. 7
General approach – Peter Kriens: One piece at a time!
Java EE monolithic app
Java EE...
© 2011 SAP AG. All rights reserved. 8
General approach – Peter Kriens: One piece at a time!
Java EE monolithic app
Java EE...
© 2011 SAP AG. All rights reserved. 9
General approach – Peter Kriens: One piece at a time!
Java EE monolithic app
Java We...
© 2011 SAP AG. All rights reserved. 10
General approach – Keep the goal in sight!
Java Web Bundle
OSGi
bundle
OSGibundle
O...
© 2011 SAP AG. All rights reserved. 11
We go for OSGi - which server to run on?
Java EE 6 compatibility page (23.Oct.2012)...
© 2011 SAP AG. All rights reserved. 12
Spring
Tested scenario: Granny’s address book
Granny’s
address
book
SpringSpring (1...
© 2011 SAP AG. All rights reserved. 13
Apache TomEE 1.0
OSGi support
 None whatsoever
 Neither uses, nor provides any
 ...
© 2011 SAP AG. All rights reserved. 14
Caucho Resin 4.0.32 free
OSGi support
 None whatsoever (but Why OSGi is cool, but ...
© 2011 SAP AG. All rights reserved. 15
JBoss Application Server 7(web)
OSGi support
 JBoss own OSGI impl.
 Tutorial avai...
© 2011 SAP AG. All rights reserved. 16
Glassfish 3.1.2.2 (web + full)
OSGi support
 HK2 is based on Apache Felix
 Additi...
© 2011 SAP AG. All rights reserved. 17
Apache Geronimo 3.0
OSGi support
 Based on Apache Felix
 Additional bundles handl...
© 2011 SAP AG. All rights reserved. 18
Other projects to watch out for
WebSphere Application Server V8.5 Liberty Profile
E...
© 2011 SAP AG. All rights reserved. 19
You still want to take the journey?
Take a look at @glynnormington “Is OSGi modular...
Thank You!krasimir.semerdzhiev@sap.com
Pictures: Woo
Upcoming SlideShare
Loading in …5
×

OSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir Semerdzhiev

338 views

Published on

OSGi Community Event 2012

Published in: Technology
  • Be the first to comment

  • Be the first to like this

OSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir Semerdzhiev

  1. 1. OSGi in Java EE servers: sneak peek inside Krasimir Semerdzhiev (SAP AG) EclipseCon Europe 2012 Pictures: Woodland Park Zoo
  2. 2. © 2011 SAP AG. All rights reserved. 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
  3. 3. © 2011 SAP AG. All rights reserved. 3 General approach – That’s our starting point!
  4. 4. © 2011 SAP AG. All rights reserved. 4 General approach – How to eat an elephant? Java EE monolithic app Java EE container Libraries in: lib META-INFlib WEB-INFlib
  5. 5. © 2011 SAP AG. All rights reserved. 5 General approach – Peter Kriens: One piece at a time! Java EE monolithic app Java EE container Libraries in: lib WEB-INFlib Java Web Bundle Shared libraries OSGi-enabled Java EE container
  6. 6. © 2011 SAP AG. All rights reserved. 6 General approach – Peter Kriens: One piece at a time! Java EE monolithic app Java EE container Libraries in: lib WEB-INFlib Java Web Bundle Shared libraries OSGi-enabled Java EE container OSGi bundle OSGi bundle OSGi bundle OSGi bundle
  7. 7. © 2011 SAP AG. All rights reserved. 7 General approach – Peter Kriens: One piece at a time! Java EE monolithic app Java EE container Libraries in: lib WEB-INFlib Java Web Bundle Shared Libraries OSGi-enabled Java EE container OSGi bundle OSGi bundle OSGi bundle OSGi bundle OSGi bundle OSGi bundle
  8. 8. © 2011 SAP AG. All rights reserved. 8 General approach – Peter Kriens: One piece at a time! Java EE monolithic app Java EE container Libraries in: lib WEB-INFlib Web Bundle Shared Libraries OSGi-enabled Java EE container OSGi bundle OSGi bundle OSGi bundle OSGi bundle OSGi bundle OSGi bundle OSGi bundle OSGibundle Projects typically stop at that state…
  9. 9. © 2011 SAP AG. All rights reserved. 9 General approach – Peter Kriens: One piece at a time! Java EE monolithic app Java Web Bundle OSGi bundle OSGibundle OSGi bundle OSGi bundle OSGi bundle OSGi bundle Java EE container Libraries in: lib WEB-INFlib OSGi-enabled Java EE container OSGi bundle OSGi bundle OSGi bundle OSGi bundle Very unlikely to reach this state! Don’t worry! That’s OK!
  10. 10. © 2011 SAP AG. All rights reserved. 10 General approach – Keep the goal in sight! Java Web Bundle OSGi bundle OSGibundle OSGi bundle OSGi bundle OSGi bundle OSGi bundle OSGi-enabled Java EE container OSGi bundle OSGi bundle OSGi bundle OSGi bundle It’s not for those reasons:  Single bundle can’t be reliably stopped!  Single bundle can’t be reliably updated!  Reference caching further spoils the party!  Random startup order as a surprise for non- aware modules.  Reference resolution for naïve package imports without a version might become tricky.
  11. 11. © 2011 SAP AG. All rights reserved. 11 We go for OSGi - which server to run on? Java EE 6 compatibility page (23.Oct.2012) Java EE 6 Web profile Java EE 6 Full profile
  12. 12. © 2011 SAP AG. All rights reserved. 12 Spring Tested scenario: Granny’s address book Granny’s address book SpringSpring (14) slf4j log4j javassist hibernate dom4j Guava Tomcat jdbc Apache juli cglib aopalliance asm antlr Source: Original sources + packaging on GitHub
  13. 13. © 2011 SAP AG. All rights reserved. 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.
  14. 14. © 2011 SAP AG. All rights reserved. 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.
  15. 15. © 2011 SAP AG. All rights reserved. 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.
  16. 16. © 2011 SAP AG. All rights reserved. 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 :-)
  17. 17. © 2011 SAP AG. All rights reserved. 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
  18. 18. © 2011 SAP AG. All rights reserved. 18 Other projects to watch out for WebSphere Application Server V8.5 Liberty Profile Eclipse Virgo
  19. 19. © 2011 SAP AG. All rights reserved. 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!
  20. 20. Thank You!krasimir.semerdzhiev@sap.com Pictures: Woo

×