SlideShare a Scribd company logo
1 of 20
Public
Migration of existing web
applications to OSGi
ESE 2010
Diyan Yordanov
SAP Labs Bulgaria
© SAP AG 2010. All rights reserved. / Page 2 Public
Agenda
1. OSGi Web Container
2. Migrating Existing Web Applications to OSGi
3. Challenges That We Overcome
4. Conclusions
© SAP AG 2010. All rights reserved. / Page 3 Public
Why web applications on OSGi?
Last years trends of software development
A good choice for product evolving
Encapsulated modules
Versioning
Class space isolation
Declarative dependencies
Dynamic refreshing and updating
Ongoing work to make OSGi platform more appealing to the enterprise
world
Eclipse Gemini – Enterprise Modules project
Eclipse Virgo – Dynamic Enterprise Application Platform project
© SAP AG 2010. All rights reserved. / Page 4 Public
OSGi Web Container
Based on Web Application Specification part of OSGi Enterprise
Specification
Provides support for Web Applications written to
Servlet 2.5 or later
JSP 2.1 or later
Java EE OSGi
WAR
© SAP AG 2010. All rights reserved. / Page 5 Public
Available OSGi specific features
Main Features in OSGi Web Container
Installation of WAR files
Installation of Web Application Bundles (WABs)
Control of configuration properties using URL parameters
Multiple applications with single context path
Web application lifecycle managed by OSGi bundle lifecycle
Facilitates interoperability between web application with other OSGi
components
Modularization – one big blob WAR to be broken into smaller modules
Dynamic deployment, and fast update of individual modules
© SAP AG 2010. All rights reserved. / Page 6 Public
Agenda
1. OSGi Web Container
2. Migrating Existing Web Applications to OSGi
3. Challenges That We Overcome
4. Conclusions
© SAP AG 2010. All rights reserved. / Page 7 Public
Migrating Web Applications to OSGi
• deploying standard WAR
• removing JAR files from WAR and declaring dependencies on
corresponding OSGi bundles
• separating web artifacts from services they depend on
Web Application
WAR
Services
CatalogService
PaymentService
Libraries
Resources
Images CSS
Spring
Hibernate
Services
CatalogService
PaymentService
How to modify the Web application in order to benefit from OSGi?
© SAP AG 2010. All rights reserved. / Page 8 Public
Agenda
1. OSGi Web Container
2. Migrating Existing Web Applications to OSGi
3. Challenges That We Overcome
4. Conclusions
© SAP AG 2010. All rights reserved. / Page 9 Public
Certain APIs and JARs are missing
Web application assumes that Java EE environment provides a certain API
or JARs in the classpath
In OSGi environment:
Manifest – single management point for the bundle
Export-Package
Import-Package
Require-Bundle
Do not rely on automated add for standard Java EE packages
Manual scan and update import packages for required ones
Or use tools like BND, Eclipse PDE, Bundlor STS
Be careful with
org.osgi.framework.bootdelagation
osgi.compatibility.bootdelagation (Eclipse Equinox specific)
© SAP AG 2010. All rights reserved. / Page 10 Public
Support for context.xml
Context.xml is widely adopted by web applications used to run on Tomcat
Support for web application context configuration was contributed to
Gemini Web
The configuration files are located as follow:
 $SERVER_HOME/config/context.xml is the default context configuration file for all
web applications.
 $SERVER_HOME/config/[enginename]/[hostname] directory contains:
o The default context configuration for all web applications of a given virtual host.
o Individual web applications’ context configuration files.
[enginename] is the name of Tomcat’s engine (“Catalina” by default) and [hostname]
names a virtual host, both of which are configured in tomcat-server.xml.
Note that the following context configuration features are not supported in Gemini Web:
• Custom class loaders.
• Specifying the context path. This is specified using the Web-ContextPath header in web
application’s MANIFEST.MF file.
• Specifying the document base directory.
© SAP AG 2010. All rights reserved. / Page 11 Public
WAR extraction
Web application assume it’s extracted on the file system
widely use file system operations
search for resources, configurations, customizations
WAB is installed as bundle
web application is run from the archive
file system operations do not work as expected
Problem
Application cannot access its configurations
Valid for web apps like Orbeon Forms, Jira,
or Confluence wiki
Solution
Implemented support for deploying web application
in exploded form from a file system directory,
following the format of the WAR file
© SAP AG 2010. All rights reserved. / Page 12 Public
Class and resource loading problems – Part I
Known problems for standard bundles are still valid for WAB
java.lang.ClassNotFoundException
Because of:
 Missing import or export package
 Import version mismatch
 Forgotten/missing component (really missing!)
 Wrong boot class delegation property
 Missing file system permissions (can’t read the JARs)
java.lang.NoClassDefFoundError
Because of:
 Exception in static block
 Missing imported class (ClassNotFoundException for it)
 Class version mismatch
Class definition is
found, but
instantiation failed!
Class definition
is missing!
© SAP AG 2010. All rights reserved. / Page 13 Public
Class and resource loading problems – Part II
java.lang.ClassCastException
Because of:
 Additional copies (besides the system bundle) of the OSGi framework classes
 Undesired additional JARs in classpath
 Clash between RT.jar and application libs(previously used embedded jars)
 JavaSE 5 vs.Java SE 6 does make a difference… (a bunch of new packages
added (StAX, JDBC 4.0, JAXB 2.0, etc.)
© SAP AG 2010. All rights reserved. / Page 14 Public
Class and resource loading problems – Part III
Classloader resource assumptions
Access resources as InputStream via the getResourceAsStream()
Access resource using URL object:
URL resourceURL = this.getClass().getResource(“agenda.txt”);
File resourceFile = new File(resourceURL.toURI());
The result is:
java.lang.IllegalArgumentException: URI scheme is not "file"
Because the URL for the resource is returned like this
bundleresource://46.fwk30983464/summit/agenda.txt
This is a limitation for Gemini Web, but is work around in Virgo
(see bug 325578).
© SAP AG 2010. All rights reserved. / Page 15 Public
Cluster Features
Some applications may use setups where some cluster functionality is
needed
If Tomcat’s “cluster-howto” doc is used the result is:
java.lang.ClassNotFoundException: org.apache.catalina.ha.tcp.SimpleTcpCluster
at
org.eclipse.gemini.web.tomcat.internal.loading.ChainedClassLoader.doLoadClass(Cha
inedClassLoader.java:174)
at
org.eclipse.gemini.web.tomcat.internal.loading.ChainedClassLoader.loadClass(Chain
edClassLoader.java:157)
at
org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:205)
Solution was provided in MS4 if Gemini Web based on fragments and:
Standard Apache Tomcat Cluster configuration is supported
Disabled by default but can be enabled when needed
© SAP AG 2010. All rights reserved. / Page 16 Public
Automatic Tools
There is NO tool for migrating standard Java EE web application (WAR) to
Web Application Bundle (WAB)
 Eclipse PDE – can help with the MANIFEST.MF file
 SpringSource Tool Suite
Different tools for creating MANIFEST.MF
 BND tool
 Apache Felix Maven plugin
 Bundlor
OSGi Enterprise Tools (Eclipse proposal)
 Wizard for creating WAB
 Tools for converting existing Java EE Dynamic Web projects to WAB project
 Tools for editing the OSGi metadata – manifest headers
 Generic OSGi server adapter
© SAP AG 2010. All rights reserved. / Page 17 Public
Agenda
1. OSGi Web Container
2. Migrating Existing Web Applications to OSGi
3. Challenges That We Overcome
4. Conclusions
© SAP AG 2010. All rights reserved. / Page 18 Public
Takeaways
Learning curve
Know your application
Assumption for unique context root
Assumption for availability of default Java EE
lib jars
Know OSGi
How classloaders work
Classloader “hell”
ClassNotFoundException, NoClassDefFoundError, ClassCastException
Avoid Class.forName()
Know your wirings
Make sure that you understand the setup of your OSGi environment
© SAP AG 2010. All rights reserved. / Page 19 Public
Conclusions
Web on OSGi does work.
Just don’t stumble over small defects.
Working together with the community is the key for success.
© SAP AG 2010. All rights reserved. / Page 20 Public
Diyan Yordanov
diyan.yordanov@sap.com
Thank you!

More Related Content

What's hot

Embedding Web UIs in your Eclipse application
Embedding Web UIs in your Eclipse applicationEmbedding Web UIs in your Eclipse application
Embedding Web UIs in your Eclipse applicationBoris Bokowski
 
Oracle ADF Architecture TV - Design - Architecting for ADF Mobile Integration
Oracle ADF Architecture TV - Design - Architecting for ADF Mobile IntegrationOracle ADF Architecture TV - Design - Architecting for ADF Mobile Integration
Oracle ADF Architecture TV - Design - Architecting for ADF Mobile IntegrationChris Muir
 
Java EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureJava EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureArun Gupta
 
2015 JavaOne LAD JSF 2.3 & MVC 1.0
2015 JavaOne LAD JSF 2.3 & MVC 1.02015 JavaOne LAD JSF 2.3 & MVC 1.0
2015 JavaOne LAD JSF 2.3 & MVC 1.0mnriem
 
Java EE7 Demystified
Java EE7 DemystifiedJava EE7 Demystified
Java EE7 DemystifiedAnkara JUG
 
JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best PracticesDavid Delabassee
 
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesJavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesMert Çalışkan
 
How to Thrive on REST/WebSocket-Based Microservices
How to Thrive on REST/WebSocket-Based MicroservicesHow to Thrive on REST/WebSocket-Based Microservices
How to Thrive on REST/WebSocket-Based MicroservicesPavel Bucek
 
Oracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Oracle ADF Architecture TV - Design - MDS Infrastructure DecisionsOracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Oracle ADF Architecture TV - Design - MDS Infrastructure DecisionsChris Muir
 
Oracle ADF Architecture TV - Planning & Getting Started - Team, Skills and D...
Oracle ADF Architecture TV -  Planning & Getting Started - Team, Skills and D...Oracle ADF Architecture TV -  Planning & Getting Started - Team, Skills and D...
Oracle ADF Architecture TV - Planning & Getting Started - Team, Skills and D...Chris Muir
 
JavaFX 2 Using the Spring Framework
JavaFX 2 Using the Spring FrameworkJavaFX 2 Using the Spring Framework
JavaFX 2 Using the Spring FrameworkStephen Chin
 
Liferay portals in real projects
Liferay portals  in real projectsLiferay portals  in real projects
Liferay portals in real projectsIBACZ
 
JavaFX and JEE 7
JavaFX and JEE 7JavaFX and JEE 7
JavaFX and JEE 7Vijay Nair
 
Travelling Light for the Long Haul - Ian Robinson
Travelling Light for the Long Haul -  Ian RobinsonTravelling Light for the Long Haul -  Ian Robinson
Travelling Light for the Long Haul - Ian Robinsonmfrancis
 
Java EE7 in action
Java EE7 in actionJava EE7 in action
Java EE7 in actionAnkara JUG
 
GlassFish OSGi Server
GlassFish OSGi ServerGlassFish OSGi Server
GlassFish OSGi ServerArtur Alves
 
Ankara JUG Ağustos 2013 - Oracle ADF
Ankara JUG Ağustos 2013 - Oracle ADFAnkara JUG Ağustos 2013 - Oracle ADF
Ankara JUG Ağustos 2013 - Oracle ADFAnkara JUG
 

What's hot (19)

Embedding Web UIs in your Eclipse application
Embedding Web UIs in your Eclipse applicationEmbedding Web UIs in your Eclipse application
Embedding Web UIs in your Eclipse application
 
Oracle ADF Architecture TV - Design - Architecting for ADF Mobile Integration
Oracle ADF Architecture TV - Design - Architecting for ADF Mobile IntegrationOracle ADF Architecture TV - Design - Architecting for ADF Mobile Integration
Oracle ADF Architecture TV - Design - Architecting for ADF Mobile Integration
 
Java EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureJava EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for future
 
2015 JavaOne LAD JSF 2.3 & MVC 1.0
2015 JavaOne LAD JSF 2.3 & MVC 1.02015 JavaOne LAD JSF 2.3 & MVC 1.0
2015 JavaOne LAD JSF 2.3 & MVC 1.0
 
Java EE7 Demystified
Java EE7 DemystifiedJava EE7 Demystified
Java EE7 Demystified
 
JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best Practices
 
Enterprise GlassFish
Enterprise GlassFishEnterprise GlassFish
Enterprise GlassFish
 
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesJavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
 
How to Thrive on REST/WebSocket-Based Microservices
How to Thrive on REST/WebSocket-Based MicroservicesHow to Thrive on REST/WebSocket-Based Microservices
How to Thrive on REST/WebSocket-Based Microservices
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Oracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Oracle ADF Architecture TV - Design - MDS Infrastructure DecisionsOracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Oracle ADF Architecture TV - Design - MDS Infrastructure Decisions
 
Oracle ADF Architecture TV - Planning & Getting Started - Team, Skills and D...
Oracle ADF Architecture TV -  Planning & Getting Started - Team, Skills and D...Oracle ADF Architecture TV -  Planning & Getting Started - Team, Skills and D...
Oracle ADF Architecture TV - Planning & Getting Started - Team, Skills and D...
 
JavaFX 2 Using the Spring Framework
JavaFX 2 Using the Spring FrameworkJavaFX 2 Using the Spring Framework
JavaFX 2 Using the Spring Framework
 
Liferay portals in real projects
Liferay portals  in real projectsLiferay portals  in real projects
Liferay portals in real projects
 
JavaFX and JEE 7
JavaFX and JEE 7JavaFX and JEE 7
JavaFX and JEE 7
 
Travelling Light for the Long Haul - Ian Robinson
Travelling Light for the Long Haul -  Ian RobinsonTravelling Light for the Long Haul -  Ian Robinson
Travelling Light for the Long Haul - Ian Robinson
 
Java EE7 in action
Java EE7 in actionJava EE7 in action
Java EE7 in action
 
GlassFish OSGi Server
GlassFish OSGi ServerGlassFish OSGi Server
GlassFish OSGi Server
 
Ankara JUG Ağustos 2013 - Oracle ADF
Ankara JUG Ağustos 2013 - Oracle ADFAnkara JUG Ağustos 2013 - Oracle ADF
Ankara JUG Ağustos 2013 - Oracle ADF
 

Similar to Migration of Existing Web Applications to OSGi at Eclipse Summit Europe 2010

Hints and Tips for Modularizing Existing Enterprise Applications with OSGi - ...
Hints and Tips for Modularizing Existing Enterprise Applications with OSGi - ...Hints and Tips for Modularizing Existing Enterprise Applications with OSGi - ...
Hints and Tips for Modularizing Existing Enterprise Applications with OSGi - ...mfrancis
 
Front-end optimisation & jQuery Internals
Front-end optimisation & jQuery InternalsFront-end optimisation & jQuery Internals
Front-end optimisation & jQuery InternalsArtur Cistov
 
Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...Aditya Jha
 
OSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir Semerdzhiev
OSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir SemerdzhievOSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir Semerdzhiev
OSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir Semerdzhievmfrancis
 
Designing JEE Application Structure
Designing JEE Application StructureDesigning JEE Application Structure
Designing JEE Application Structureodedns
 
Managing Your Runtime With P2
Managing Your Runtime With P2Managing Your Runtime With P2
Managing Your Runtime With P2Pascal Rapicault
 
Front-end optimisation & jQuery Internals (Pycon)
Front-end optimisation & jQuery Internals (Pycon)Front-end optimisation & jQuery Internals (Pycon)
Front-end optimisation & jQuery Internals (Pycon)Artur Cistov
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introductionvstorm83
 
Glass Fish Slides Fy2009 2
Glass Fish Slides Fy2009 2Glass Fish Slides Fy2009 2
Glass Fish Slides Fy2009 2Abhishek Gupta
 
Gemini WEB and Virgo
Gemini WEB and VirgoGemini WEB and Virgo
Gemini WEB and VirgoHristo Iliev
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Mack Hardy
 
GWT training session 1
GWT training session 1GWT training session 1
GWT training session 1SNEHAL MASNE
 

Similar to Migration of Existing Web Applications to OSGi at Eclipse Summit Europe 2010 (20)

Hints and Tips for Modularizing Existing Enterprise Applications with OSGi - ...
Hints and Tips for Modularizing Existing Enterprise Applications with OSGi - ...Hints and Tips for Modularizing Existing Enterprise Applications with OSGi - ...
Hints and Tips for Modularizing Existing Enterprise Applications with OSGi - ...
 
Front-end optimisation & jQuery Internals
Front-end optimisation & jQuery InternalsFront-end optimisation & jQuery Internals
Front-end optimisation & jQuery Internals
 
GlassFish and JavaEE, Today and Future
GlassFish and JavaEE, Today and FutureGlassFish and JavaEE, Today and Future
GlassFish and JavaEE, Today and Future
 
Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...
 
Ah java-ppt1
Ah java-ppt1Ah java-ppt1
Ah java-ppt1
 
OSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir Semerdzhiev
OSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir SemerdzhievOSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir Semerdzhiev
OSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir Semerdzhiev
 
Designing JEE Application Structure
Designing JEE Application StructureDesigning JEE Application Structure
Designing JEE Application Structure
 
Managing Your Runtime With P2
Managing Your Runtime With P2Managing Your Runtime With P2
Managing Your Runtime With P2
 
Front-end optimisation & jQuery Internals (Pycon)
Front-end optimisation & jQuery Internals (Pycon)Front-end optimisation & jQuery Internals (Pycon)
Front-end optimisation & jQuery Internals (Pycon)
 
OSGi summary
OSGi summaryOSGi summary
OSGi summary
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introduction
 
Glass Fish Slides Fy2009 2
Glass Fish Slides Fy2009 2Glass Fish Slides Fy2009 2
Glass Fish Slides Fy2009 2
 
Gemini WEB and Virgo
Gemini WEB and VirgoGemini WEB and Virgo
Gemini WEB and Virgo
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
 
GlassFish Embedded API
GlassFish Embedded APIGlassFish Embedded API
GlassFish Embedded API
 
Spring
SpringSpring
Spring
 
Spring
SpringSpring
Spring
 
Spring
SpringSpring
Spring
 
GlassFish v3 - Architecture
GlassFish v3 - ArchitectureGlassFish v3 - Architecture
GlassFish v3 - Architecture
 
GWT training session 1
GWT training session 1GWT training session 1
GWT training session 1
 

Recently uploaded

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Recently uploaded (20)

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Migration of Existing Web Applications to OSGi at Eclipse Summit Europe 2010

  • 1. Public Migration of existing web applications to OSGi ESE 2010 Diyan Yordanov SAP Labs Bulgaria
  • 2. © SAP AG 2010. All rights reserved. / Page 2 Public Agenda 1. OSGi Web Container 2. Migrating Existing Web Applications to OSGi 3. Challenges That We Overcome 4. Conclusions
  • 3. © SAP AG 2010. All rights reserved. / Page 3 Public Why web applications on OSGi? Last years trends of software development A good choice for product evolving Encapsulated modules Versioning Class space isolation Declarative dependencies Dynamic refreshing and updating Ongoing work to make OSGi platform more appealing to the enterprise world Eclipse Gemini – Enterprise Modules project Eclipse Virgo – Dynamic Enterprise Application Platform project
  • 4. © SAP AG 2010. All rights reserved. / Page 4 Public OSGi Web Container Based on Web Application Specification part of OSGi Enterprise Specification Provides support for Web Applications written to Servlet 2.5 or later JSP 2.1 or later Java EE OSGi WAR
  • 5. © SAP AG 2010. All rights reserved. / Page 5 Public Available OSGi specific features Main Features in OSGi Web Container Installation of WAR files Installation of Web Application Bundles (WABs) Control of configuration properties using URL parameters Multiple applications with single context path Web application lifecycle managed by OSGi bundle lifecycle Facilitates interoperability between web application with other OSGi components Modularization – one big blob WAR to be broken into smaller modules Dynamic deployment, and fast update of individual modules
  • 6. © SAP AG 2010. All rights reserved. / Page 6 Public Agenda 1. OSGi Web Container 2. Migrating Existing Web Applications to OSGi 3. Challenges That We Overcome 4. Conclusions
  • 7. © SAP AG 2010. All rights reserved. / Page 7 Public Migrating Web Applications to OSGi • deploying standard WAR • removing JAR files from WAR and declaring dependencies on corresponding OSGi bundles • separating web artifacts from services they depend on Web Application WAR Services CatalogService PaymentService Libraries Resources Images CSS Spring Hibernate Services CatalogService PaymentService How to modify the Web application in order to benefit from OSGi?
  • 8. © SAP AG 2010. All rights reserved. / Page 8 Public Agenda 1. OSGi Web Container 2. Migrating Existing Web Applications to OSGi 3. Challenges That We Overcome 4. Conclusions
  • 9. © SAP AG 2010. All rights reserved. / Page 9 Public Certain APIs and JARs are missing Web application assumes that Java EE environment provides a certain API or JARs in the classpath In OSGi environment: Manifest – single management point for the bundle Export-Package Import-Package Require-Bundle Do not rely on automated add for standard Java EE packages Manual scan and update import packages for required ones Or use tools like BND, Eclipse PDE, Bundlor STS Be careful with org.osgi.framework.bootdelagation osgi.compatibility.bootdelagation (Eclipse Equinox specific)
  • 10. © SAP AG 2010. All rights reserved. / Page 10 Public Support for context.xml Context.xml is widely adopted by web applications used to run on Tomcat Support for web application context configuration was contributed to Gemini Web The configuration files are located as follow:  $SERVER_HOME/config/context.xml is the default context configuration file for all web applications.  $SERVER_HOME/config/[enginename]/[hostname] directory contains: o The default context configuration for all web applications of a given virtual host. o Individual web applications’ context configuration files. [enginename] is the name of Tomcat’s engine (“Catalina” by default) and [hostname] names a virtual host, both of which are configured in tomcat-server.xml. Note that the following context configuration features are not supported in Gemini Web: • Custom class loaders. • Specifying the context path. This is specified using the Web-ContextPath header in web application’s MANIFEST.MF file. • Specifying the document base directory.
  • 11. © SAP AG 2010. All rights reserved. / Page 11 Public WAR extraction Web application assume it’s extracted on the file system widely use file system operations search for resources, configurations, customizations WAB is installed as bundle web application is run from the archive file system operations do not work as expected Problem Application cannot access its configurations Valid for web apps like Orbeon Forms, Jira, or Confluence wiki Solution Implemented support for deploying web application in exploded form from a file system directory, following the format of the WAR file
  • 12. © SAP AG 2010. All rights reserved. / Page 12 Public Class and resource loading problems – Part I Known problems for standard bundles are still valid for WAB java.lang.ClassNotFoundException Because of:  Missing import or export package  Import version mismatch  Forgotten/missing component (really missing!)  Wrong boot class delegation property  Missing file system permissions (can’t read the JARs) java.lang.NoClassDefFoundError Because of:  Exception in static block  Missing imported class (ClassNotFoundException for it)  Class version mismatch Class definition is found, but instantiation failed! Class definition is missing!
  • 13. © SAP AG 2010. All rights reserved. / Page 13 Public Class and resource loading problems – Part II java.lang.ClassCastException Because of:  Additional copies (besides the system bundle) of the OSGi framework classes  Undesired additional JARs in classpath  Clash between RT.jar and application libs(previously used embedded jars)  JavaSE 5 vs.Java SE 6 does make a difference… (a bunch of new packages added (StAX, JDBC 4.0, JAXB 2.0, etc.)
  • 14. © SAP AG 2010. All rights reserved. / Page 14 Public Class and resource loading problems – Part III Classloader resource assumptions Access resources as InputStream via the getResourceAsStream() Access resource using URL object: URL resourceURL = this.getClass().getResource(“agenda.txt”); File resourceFile = new File(resourceURL.toURI()); The result is: java.lang.IllegalArgumentException: URI scheme is not "file" Because the URL for the resource is returned like this bundleresource://46.fwk30983464/summit/agenda.txt This is a limitation for Gemini Web, but is work around in Virgo (see bug 325578).
  • 15. © SAP AG 2010. All rights reserved. / Page 15 Public Cluster Features Some applications may use setups where some cluster functionality is needed If Tomcat’s “cluster-howto” doc is used the result is: java.lang.ClassNotFoundException: org.apache.catalina.ha.tcp.SimpleTcpCluster at org.eclipse.gemini.web.tomcat.internal.loading.ChainedClassLoader.doLoadClass(Cha inedClassLoader.java:174) at org.eclipse.gemini.web.tomcat.internal.loading.ChainedClassLoader.loadClass(Chain edClassLoader.java:157) at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:205) Solution was provided in MS4 if Gemini Web based on fragments and: Standard Apache Tomcat Cluster configuration is supported Disabled by default but can be enabled when needed
  • 16. © SAP AG 2010. All rights reserved. / Page 16 Public Automatic Tools There is NO tool for migrating standard Java EE web application (WAR) to Web Application Bundle (WAB)  Eclipse PDE – can help with the MANIFEST.MF file  SpringSource Tool Suite Different tools for creating MANIFEST.MF  BND tool  Apache Felix Maven plugin  Bundlor OSGi Enterprise Tools (Eclipse proposal)  Wizard for creating WAB  Tools for converting existing Java EE Dynamic Web projects to WAB project  Tools for editing the OSGi metadata – manifest headers  Generic OSGi server adapter
  • 17. © SAP AG 2010. All rights reserved. / Page 17 Public Agenda 1. OSGi Web Container 2. Migrating Existing Web Applications to OSGi 3. Challenges That We Overcome 4. Conclusions
  • 18. © SAP AG 2010. All rights reserved. / Page 18 Public Takeaways Learning curve Know your application Assumption for unique context root Assumption for availability of default Java EE lib jars Know OSGi How classloaders work Classloader “hell” ClassNotFoundException, NoClassDefFoundError, ClassCastException Avoid Class.forName() Know your wirings Make sure that you understand the setup of your OSGi environment
  • 19. © SAP AG 2010. All rights reserved. / Page 19 Public Conclusions Web on OSGi does work. Just don’t stumble over small defects. Working together with the community is the key for success.
  • 20. © SAP AG 2010. All rights reserved. / Page 20 Public Diyan Yordanov diyan.yordanov@sap.com Thank you!