SlideShare a Scribd company logo
Third-Party Libraries and OSGi
a complicated relationship
Senior Solution Architect
6 years of WCMS experience
Loves working with Java
(script)
Sascha Brinkmann
Hobbies: Biking, Hiking, Travelling
Contact: sb@eggs.de @sasusu
About Me
About Us
About Us
1984 Foundation year
2004 Adobe Business Partner
2005 Adobe Authorized Training Center
2010 Winner of Siemens top+ Award
2014 100% Adobe focussed for 10 years
Employees: 45
Located: Munich, Germany
Happy Adobe customers: +40
➢ Motivation
➢ Challenge
➢ Analysis Possible Strategies
➢ Tips & Tricks
➢ Conclusion
➢ OSGi Basics
Table of Content
Integration of AEM into a heterogeneous IT systems landscape
with interfaces to various subsystems.
AEM
LDAP / Active Directory
Microsoft SharePoint
Microsoft Enterprise Search (FAST)
IBM Lotus Notes Domino
SAP / Hybris
SQL Database
Rest- and Webservices
Amazon S3
Facbook
Twitter
YouTube
Brightcove
Email
FTP
Google Search Appliance
Motivation
InternalExternal
Our work is all about solving business problems. Solutions for
almost every technical challenge are provided by third party
libraries from the central maven repository.
Motivation
How can I use various types of third party libraries
and frameworks within my projects?
Challenge
OSGi Basics
Allrightsreserved
Gosainkunda, Nepal
OSGi Basics - Apache Felix
Apache Felix is a fundamental element of the technology stack of
the Adobe Experience Manager (AEM). It provides the
environment for all Java written components.
Java Content Repository (CRX)
Apache Sling
Adobe Experience Manager (WCMS)
OSGi Runtime (Apache Felix)
one Classloader for the
whole Java application
one Classloader per OSGi bundle
Bundle B
Bundle A
Bundle C
Bundle D
Library A
Library C
Library B
Library D
OSGi Basics - Classloading
Key difference between traditional Java Applications and
Applications running within OSGi.
Bundle
Manifest
Consumes Provides
OSGi Basics - Bundle Structure
Bundle Identifier
Packages provided to other bundles
Packages Consumed from other bundles
OSGi Basics - Bundle Manifest
The manifest file is a set of OSGi specific headers. It defines how
to deploy and run the OSGi bundle.
Apache Felix
Bundle Plugin
Dependency to
other Bundle
OSGi Basics - Maven POM Config
The Apache Felix Bundle Plugin for Maven enhances artifacts
with the bundle manifest.
Strategies to use third party libraries
First Option
Embedding Libraries
Second Option
Libraries as Bundles
First Option Embedding Libraries
Allrightsreserved
Nanuku, Fiji
Bundle
Manifest
First Option - Embedding Libraries
Same classloader for external libraries and bundle classes.
Libraries embedded
within the bundle
First Option - Embedding Libraries
Bundle Manifest
Dependency to be embedded
with implicit scope ‘compile’
Instruction to embed all
dependencies with scope
compile & runtime
First Option - Embedding Libraries
Maven POM snippet
Apache Felix needs to resolve all dependencies prior to
start the bundle.
First Option - Embedding Libraries
Transitive dependencies
are not embedded
automatically!
First Option - Embedding Libraries
Maven Artifact Dependency Tree
A large number of embedded
libraries within your OSGi bundle ...
… can cause an even larger
number of unresolveable
packages.
First Option - Embedding Libraries
Additional dependencies to
resolve the missing packages.
Instruction containing a list of
packages which should be
ignored by Apache Felix.
Instruction to embed
transitive dependencies
First Option - Embedding Libraries
Further configuration parameters to adjust the generated manifest.
First Option - Embedding Libraries
The result has to be that the bundle is deployed with no unresolved
packages and activated successfully
Bundle is activated and ready
for operation.
Advantages
➢ Easy to archive
➢ Usage is encapsulated
➢ Same classloader between class-files and library
Disadvantages
➢ Usage is limited to bundle
➢ No separation of concerns
➢ Multiple usage in different bundles increase the memory
consumption and the probability of conflicts when sharing
references
First Option - Embedding Libraries
Second Option
Libraries as Bundle
Allrightsreserved
Hollywood, USA
Transformation or encapsulation of Java libraries to turn them
into OSGi bundles
Searching for existing OSGi bundles
End of availability after September 2014 Just kicked off
Successor
Commandline Tool Bundle Plugin
Second Option - Libraries as Bundle
Second Option - Libraries as Bundle
Advantages
➢ Functionality can be shared across multiple bundles
➢ Separation of concerns
➢ Bundles can be updated independently
➢ Class reference conflicts can be avoided, as there is only one
shared source
Disadvantages
➢ Most libraries are not available as OSGi bundles
➢ Dynamic class resolving via Class.forName() or reflection is
difficult
OSGi Basics - Bundles vs. Fragments
the bundle where the fragment is attached to
Bundle
Fragment
Has its own classloader
and lifecycle. Can be
referenced by other
bundles.
Is part of another Bundle
and utilizes its classloader.
Extends the imports and
exports of the host bundle.
Fragment Manifest
Hibernate ORM is an object-relational mapping library for the Java
language, providing a framework for mapping an object-oriented domain
model to a traditional relational database.
Entities
and DAO
JDBC
DriverHibernate
Core Bundle
Consumes
Entity
Bridge Consumes
Extends
Extends
OSGi
Fragment
OSGi
Bundle
Second Option - Libraries as Bundle
The system bundle is a special bundle that represents the OSGi
framework itself, from within that framework.
Characteristics
➢ Bundle ID 0
➢ It exports packages from the JRE
➢ Only packages which are available in any JVM are provided. All
java* packages for example javax.swing, org.w3c.com etc. are
excluded
➢ Exports the OSGi framework packages such as org.osgi.framework
OSGi Basics - System Bundle
Apache Axis2 is a Web Services / SOAP / WSDL engine
and the successor to the widely used Apache Axis SOAP
stack.
System
Bundle
Axis 2
FragmentExtends
Entities
and DAO
Consumes
Second Option - Libraries as Bundle
OSGi
Fragment
OSGi
Bundle
Some third party libraries make us of the current thread classloader that definitely runs
within another context than the bundle class loader. To allow the third party library to
access bundle resources, the current thread classloader has to be replaced for this action.
Dealing with Class Loader Issues
➢ There is no best practice. Each framework needs its individual
solution!
➢ Working with third party libraries is like a box of chocolates -
you never know what you're gonna get.
➢ You know it’s working when you see it’s working!
➢ Most frameworks don’t support OSGi or are not properly
tested with Apache Felix.
➢ It needs a community with support from Adobe sharing
experiences and best practices including the use of third party
libraries.
Conclusion
Your chance for
remarks and questions!
All rights reserved Los Angeles, USA
The End
Allrightsreserved
Nadi, Fiji
Presentation
http://www.eggs.de/connectwebex2014
The Author
Sascha Brinkmann - sb@eggs.de
Sales Representative
Martin Brösamle - mb@eggs.de
Get in Touch
Terms of Use
This work is licensed under a
Creative Commons Attribution-NoDerivatives
4.0 International License
All photos copyright © Sascha Brinkmann,
all rights reserved.

More Related Content

PDF
PDF
[보험사를 위한 AWS Data Analytics Day] 2_금융의 핵심자산 Data, 글로ᄇ...
PDF
Laravel for e commerce build small store now and scale big later
PDF
AWS Summit Seoul 2023 | Confluent와 함께하는 실시간 데이터와 클라우드 여정
PDF
Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...
PDF
TechnicalTerraformLandingZones121120229238.pdf
PDF
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
PPTX
Webinar: Simplifying the Enterprise Hybrid Cloud with Azure Stack HCI
[보험사를 위한 AWS Data Analytics Day] 2_금융의 핵심자산 Data, 글로ᄇ...
Laravel for e commerce build small store now and scale big later
AWS Summit Seoul 2023 | Confluent와 함께하는 실시간 데이터와 클라우드 여정
Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...
TechnicalTerraformLandingZones121120229238.pdf
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
Webinar: Simplifying the Enterprise Hybrid Cloud with Azure Stack HCI

What's hot (20)

PDF
Real time stock processing with apache nifi, apache flink and apache kafka
PDF
RDBMS to Graph
PDF
효율적인 빅데이터 분석 및 처리를 위한 Glue, EMR 활용 - 김태현 솔루션즈 아키텍트, AWS :: AWS Summit Seoul 2019
PPTX
ASP.NET MVC Presentation
PDF
Social Media Conference 2010
PPTX
Data Sharing with Snowflake
PDF
Time to Talk about Data Mesh
PDF
Streaming architecture patterns
PDF
AWS Summit Seoul 2023 | 클라우드를 통한 온/오프라인 비즈니스의 통합, GS리테일의 현대화
PDF
AWS Summit Seoul 2023 | SK와 함께하는 AWS Migration Journey & App Modernization 전략
PDF
https://www.slideshare.net/neo4j/a-fusion-of-machine-learning-and-graph-analy...
PPTX
Microsoft Azure Cost Optimization and improve efficiency
PDF
The Data Platform for Today's Intelligent Applications.pdf
PPTX
글로벌 기업들의 효과적인 데이터 분석을 위한 Data Lake 구축 및 분석 사례 - 김준형 (AWS 솔루션즈 아키텍트)
PDF
AWS Summit Seoul 2023 | 롯데면세점이 고객에게 차별화된 경험을 제공하는 방법: AWS Native 서비스를 활용한 초개인...
PDF
SK Telecom - 망관리 프로젝트 TANGO의 오픈소스 데이터베이스 전환 여정 - 발표자 : 박승전, Project Manager, ...
PPTX
Neo4j & AWS Bedrock workshop at GraphSummit London 14 Nov 2023.pptx
PDF
Amazon Redshift Deep Dive - Serverless, Streaming, ML, Auto Copy (New feature...
PPTX
AWS VS AZURE VS GCP.pptx
PDF
코리안리 - 데이터 분석 플랫폼 구축 여정, 그 시작과 과제 - 발표자: 김석기 그룹장, 데이터비즈니스센터, 메가존클라우드 ::: AWS ...
Real time stock processing with apache nifi, apache flink and apache kafka
RDBMS to Graph
효율적인 빅데이터 분석 및 처리를 위한 Glue, EMR 활용 - 김태현 솔루션즈 아키텍트, AWS :: AWS Summit Seoul 2019
ASP.NET MVC Presentation
Social Media Conference 2010
Data Sharing with Snowflake
Time to Talk about Data Mesh
Streaming architecture patterns
AWS Summit Seoul 2023 | 클라우드를 통한 온/오프라인 비즈니스의 통합, GS리테일의 현대화
AWS Summit Seoul 2023 | SK와 함께하는 AWS Migration Journey & App Modernization 전략
https://www.slideshare.net/neo4j/a-fusion-of-machine-learning-and-graph-analy...
Microsoft Azure Cost Optimization and improve efficiency
The Data Platform for Today's Intelligent Applications.pdf
글로벌 기업들의 효과적인 데이터 분석을 위한 Data Lake 구축 및 분석 사례 - 김준형 (AWS 솔루션즈 아키텍트)
AWS Summit Seoul 2023 | 롯데면세점이 고객에게 차별화된 경험을 제공하는 방법: AWS Native 서비스를 활용한 초개인...
SK Telecom - 망관리 프로젝트 TANGO의 오픈소스 데이터베이스 전환 여정 - 발표자 : 박승전, Project Manager, ...
Neo4j & AWS Bedrock workshop at GraphSummit London 14 Nov 2023.pptx
Amazon Redshift Deep Dive - Serverless, Streaming, ML, Auto Copy (New feature...
AWS VS AZURE VS GCP.pptx
코리안리 - 데이터 분석 플랫폼 구축 여정, 그 시작과 과제 - 발표자: 김석기 그룹장, 데이터비즈니스센터, 메가존클라우드 ::: AWS ...
Ad

Viewers also liked (6)

PDF
Embracing Collaborative Design
PDF
Web Development for UX Designers
PPTX
CMS as a Marketing Tool - Drupal
PPTX
UX development – Drupaljam 2015
PDF
The six key steps to AEM architecture
PDF
AEM Best Practices for Component Development
Embracing Collaborative Design
Web Development for UX Designers
CMS as a Marketing Tool - Drupal
UX development – Drupaljam 2015
The six key steps to AEM architecture
AEM Best Practices for Component Development
Ad

Similar to Third party libraries and OSGi - a complicated relationship (20)

PPTX
Introduction to OSGi
PDF
Icsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-libraries
PDF
Eclipse_Building_Blocks
PPTX
Introduction to OSGi - Part-1
PDF
Fantastic four machine_learning_java_libraries
PDF
Modularity problems
PPTX
Top 10 Libraries of Java.pptx
PDF
Jax london 2011
PDF
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
PPT
Frc java5-8andeclipse
PPTX
Javascript And CSS Libraries
PDF
composer_talk_20160209
PPTX
Composer namespacing
PPT
OSGi & Blueprint
PPT
OSGi Enablement For Apache Tuscany
PPT
Osgi Webinar
PDF
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
PDF
Monoliths are so 2001 – What you need is Modularity
PPT
Fundamentals of JAVA
PPT
Classes and Objects
Introduction to OSGi
Icsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-libraries
Eclipse_Building_Blocks
Introduction to OSGi - Part-1
Fantastic four machine_learning_java_libraries
Modularity problems
Top 10 Libraries of Java.pptx
Jax london 2011
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Frc java5-8andeclipse
Javascript And CSS Libraries
composer_talk_20160209
Composer namespacing
OSGi & Blueprint
OSGi Enablement For Apache Tuscany
Osgi Webinar
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
Monoliths are so 2001 – What you need is Modularity
Fundamentals of JAVA
Classes and Objects

Recently uploaded (20)

PPTX
E -tech empowerment technologies PowerPoint
PDF
Paper PDF World Game (s) Great Redesign.pdf
PDF
Sims 4 Historia para lo sims 4 para jugar
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PDF
Testing WebRTC applications at scale.pdf
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PPTX
presentation_pfe-universite-molay-seltan.pptx
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PPTX
Introduction to Information and Communication Technology
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PPTX
introduction about ICD -10 & ICD-11 ppt.pptx
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PPTX
Module 1 - Cyber Law and Ethics 101.pptx
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PPTX
artificial intelligence overview of it and more
E -tech empowerment technologies PowerPoint
Paper PDF World Game (s) Great Redesign.pdf
Sims 4 Historia para lo sims 4 para jugar
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
Testing WebRTC applications at scale.pdf
Introuction about ICD -10 and ICD-11 PPT.pptx
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PptxGenJS_Demo_Chart_20250317130215833.pptx
Slides PPTX World Game (s) Eco Economic Epochs.pptx
presentation_pfe-universite-molay-seltan.pptx
Tenda Login Guide: Access Your Router in 5 Easy Steps
Job_Card_System_Styled_lorem_ipsum_.pptx
Unit-1 introduction to cyber security discuss about how to secure a system
Introduction to Information and Communication Technology
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
introduction about ICD -10 & ICD-11 ppt.pptx
SASE Traffic Flow - ZTNA Connector-1.pdf
Module 1 - Cyber Law and Ethics 101.pptx
WebRTC in SignalWire - troubleshooting media negotiation
artificial intelligence overview of it and more

Third party libraries and OSGi - a complicated relationship

  • 1. Third-Party Libraries and OSGi a complicated relationship
  • 2. Senior Solution Architect 6 years of WCMS experience Loves working with Java (script) Sascha Brinkmann Hobbies: Biking, Hiking, Travelling Contact: sb@eggs.de @sasusu About Me
  • 4. About Us 1984 Foundation year 2004 Adobe Business Partner 2005 Adobe Authorized Training Center 2010 Winner of Siemens top+ Award 2014 100% Adobe focussed for 10 years Employees: 45 Located: Munich, Germany Happy Adobe customers: +40
  • 5. ➢ Motivation ➢ Challenge ➢ Analysis Possible Strategies ➢ Tips & Tricks ➢ Conclusion ➢ OSGi Basics Table of Content
  • 6. Integration of AEM into a heterogeneous IT systems landscape with interfaces to various subsystems. AEM LDAP / Active Directory Microsoft SharePoint Microsoft Enterprise Search (FAST) IBM Lotus Notes Domino SAP / Hybris SQL Database Rest- and Webservices Amazon S3 Facbook Twitter YouTube Brightcove Email FTP Google Search Appliance Motivation InternalExternal
  • 7. Our work is all about solving business problems. Solutions for almost every technical challenge are provided by third party libraries from the central maven repository. Motivation
  • 8. How can I use various types of third party libraries and frameworks within my projects? Challenge
  • 10. OSGi Basics - Apache Felix Apache Felix is a fundamental element of the technology stack of the Adobe Experience Manager (AEM). It provides the environment for all Java written components. Java Content Repository (CRX) Apache Sling Adobe Experience Manager (WCMS) OSGi Runtime (Apache Felix)
  • 11. one Classloader for the whole Java application one Classloader per OSGi bundle Bundle B Bundle A Bundle C Bundle D Library A Library C Library B Library D OSGi Basics - Classloading Key difference between traditional Java Applications and Applications running within OSGi.
  • 13. Bundle Identifier Packages provided to other bundles Packages Consumed from other bundles OSGi Basics - Bundle Manifest The manifest file is a set of OSGi specific headers. It defines how to deploy and run the OSGi bundle.
  • 14. Apache Felix Bundle Plugin Dependency to other Bundle OSGi Basics - Maven POM Config The Apache Felix Bundle Plugin for Maven enhances artifacts with the bundle manifest.
  • 15. Strategies to use third party libraries First Option Embedding Libraries Second Option Libraries as Bundles
  • 16. First Option Embedding Libraries Allrightsreserved Nanuku, Fiji
  • 17. Bundle Manifest First Option - Embedding Libraries Same classloader for external libraries and bundle classes.
  • 18. Libraries embedded within the bundle First Option - Embedding Libraries Bundle Manifest
  • 19. Dependency to be embedded with implicit scope ‘compile’ Instruction to embed all dependencies with scope compile & runtime First Option - Embedding Libraries Maven POM snippet
  • 20. Apache Felix needs to resolve all dependencies prior to start the bundle. First Option - Embedding Libraries
  • 21. Transitive dependencies are not embedded automatically! First Option - Embedding Libraries Maven Artifact Dependency Tree
  • 22. A large number of embedded libraries within your OSGi bundle ... … can cause an even larger number of unresolveable packages. First Option - Embedding Libraries
  • 23. Additional dependencies to resolve the missing packages. Instruction containing a list of packages which should be ignored by Apache Felix. Instruction to embed transitive dependencies First Option - Embedding Libraries Further configuration parameters to adjust the generated manifest.
  • 24. First Option - Embedding Libraries The result has to be that the bundle is deployed with no unresolved packages and activated successfully Bundle is activated and ready for operation.
  • 25. Advantages ➢ Easy to archive ➢ Usage is encapsulated ➢ Same classloader between class-files and library Disadvantages ➢ Usage is limited to bundle ➢ No separation of concerns ➢ Multiple usage in different bundles increase the memory consumption and the probability of conflicts when sharing references First Option - Embedding Libraries
  • 26. Second Option Libraries as Bundle Allrightsreserved Hollywood, USA
  • 27. Transformation or encapsulation of Java libraries to turn them into OSGi bundles Searching for existing OSGi bundles End of availability after September 2014 Just kicked off Successor Commandline Tool Bundle Plugin Second Option - Libraries as Bundle
  • 28. Second Option - Libraries as Bundle Advantages ➢ Functionality can be shared across multiple bundles ➢ Separation of concerns ➢ Bundles can be updated independently ➢ Class reference conflicts can be avoided, as there is only one shared source Disadvantages ➢ Most libraries are not available as OSGi bundles ➢ Dynamic class resolving via Class.forName() or reflection is difficult
  • 29. OSGi Basics - Bundles vs. Fragments the bundle where the fragment is attached to Bundle Fragment Has its own classloader and lifecycle. Can be referenced by other bundles. Is part of another Bundle and utilizes its classloader. Extends the imports and exports of the host bundle. Fragment Manifest
  • 30. Hibernate ORM is an object-relational mapping library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database. Entities and DAO JDBC DriverHibernate Core Bundle Consumes Entity Bridge Consumes Extends Extends OSGi Fragment OSGi Bundle Second Option - Libraries as Bundle
  • 31. The system bundle is a special bundle that represents the OSGi framework itself, from within that framework. Characteristics ➢ Bundle ID 0 ➢ It exports packages from the JRE ➢ Only packages which are available in any JVM are provided. All java* packages for example javax.swing, org.w3c.com etc. are excluded ➢ Exports the OSGi framework packages such as org.osgi.framework OSGi Basics - System Bundle
  • 32. Apache Axis2 is a Web Services / SOAP / WSDL engine and the successor to the widely used Apache Axis SOAP stack. System Bundle Axis 2 FragmentExtends Entities and DAO Consumes Second Option - Libraries as Bundle OSGi Fragment OSGi Bundle
  • 33. Some third party libraries make us of the current thread classloader that definitely runs within another context than the bundle class loader. To allow the third party library to access bundle resources, the current thread classloader has to be replaced for this action. Dealing with Class Loader Issues
  • 34. ➢ There is no best practice. Each framework needs its individual solution! ➢ Working with third party libraries is like a box of chocolates - you never know what you're gonna get. ➢ You know it’s working when you see it’s working! ➢ Most frameworks don’t support OSGi or are not properly tested with Apache Felix. ➢ It needs a community with support from Adobe sharing experiences and best practices including the use of third party libraries. Conclusion
  • 35. Your chance for remarks and questions! All rights reserved Los Angeles, USA
  • 37. Presentation http://www.eggs.de/connectwebex2014 The Author Sascha Brinkmann - sb@eggs.de Sales Representative Martin Brösamle - mb@eggs.de Get in Touch
  • 38. Terms of Use This work is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License All photos copyright © Sascha Brinkmann, all rights reserved.