Using OSGi in Modular WebSphere Applications

Similar documents
OSGi Best Practices. Emily

WebSphere Application Server Support for OSGi Applications

OSGi & Java Modularity

Is OSGi Ready for the Enterprise?

OSGi in WebSphere : The Story so far

WebSphere Application Server V7 OSGi, JPA, and Modern Batch Feature Packs

WebSphere Application Server V8 New Features and a primer on WAS V8.5

Converting (Large) Applications to OSGi

IBM WebSphere Application Server 8. Java EE 6 Feature Packs

Modular Java Applications with Spring, dm Server and OSGi

IBM. Java Yet another Language. on the mainframe. Tobias Leicher, Technical Specialist for CICS IBM Corporation

The CICS JVMServer and The WebSphere Operational Decision Manager Rules Execution Engine (ILOG)

Leverage Rational Application Developer v8 to develop OSGi application and test with Websphere Application Server v8

Breaking Apart the Monolith with Modularity and Microservices CON3127

OSGi on the Server. Martin Lippert (it-agile GmbH)

Equinox OSGi: Pervasive Componentization

B. Assets are shared-by-copy by default; convert the library into *.jar and configure it as a shared library on the server runtime.

Enterprise Development

Leverage Rational Application Developer v8 to develop Java EE6 application and test with WebSphere Application Server v8

OSGi. Building LinkedIn's Next Generation Architecture with OSGI

Building LinkedIn's Next Generation Architecture with OSGI

From Development to Production with the IBM WebSphere Application Server Liberty Profile IBM Redbooks Solution Guide

Agenda. Why OSGi. What is OSGi. How OSGi Works. Apache projects related to OSGi Progress Software Corporation. All rights reserved.

J2EE Development. Course Detail: Audience. Duration. Course Abstract. Course Objectives. Course Topics. Class Format.

Christopher Frost Virgo Committer Martin Lippert Lead, Spring Development Tools SpringSource, a division of VMware 3rd November 2011

Liberate your components with OSGi services

WebSphere Foundation Update and Technical Direction

NetBeans IDE Field Guide

Tuscany: Applying OSGi modularity after the fact

EclipseLink. Solutions Guide for EclipseLink Release 2.6. June Beta Draft

Building the Enterprise

11-15 DECEMBER ANTWERP BELGIUM

IBM Rational Application Developer for WebSphere Software, Version 7.0

2017, IBM Corporation Liberty z/os Good Practices. WebSphere Liberty z/os Applications and Application Deployment

Spring Dynamic Modules

Techniques for Building J2EE Applications

Introduction to Web Application Development Using JEE, Frameworks, Web Services and AJAX

Spring Framework 2.5: New and Notable. Ben Alex, Principal Software Engineer, SpringSource

Vision of J2EE. Why J2EE? Need for. J2EE Suite. J2EE Based Distributed Application Architecture Overview. Umair Javed 1

Fast Track to EJB 3.0 and the JPA Using JBoss

1 Markus Eisele, Insurance - Strategic IT-Architecture

Enterprise Java Development using JPA, Hibernate and Spring. Srini Penchikala Detroit JUG Developer Day Conference November 14, 2009

OSGi Subsystems from theory to practice Glyn Normington. Eclipse Virgo Project Lead SpringSource/VMware

1.2. Name(s) and address of Document Author(s)/Supplier: Sahoo: 1.3. Date of This Document: 12 July 2008

WebSphere Application Server What s new in WAS V7.0 for Developers

Introduction. Key Features and Benefits

J2EE - Version: 25. Developing Enterprise Applications with J2EE Enterprise Technologies

Classloader J2EE rakendusserveris (Bea Weblogic Server, IBM WebSphere)

Copyright Oracle Corporation and VMware Inc, Enterprise Modules Project (Gemini) Proposal

Seam 3. Pete Muir JBoss, a Division of Red Hat

Java- EE Web Application Development with Enterprise JavaBeans and Web Services

Architecting Java solutions for CICS

Development of Advanced Applications with IBM WebSphere Application Server Liberty Profile IBM Redbooks Solution Guide

Equinox Project Update

IBM. IBM WebSphere Application Server Migration Toolkit. WebSphere Application Server. Version 9.0 Release

SCA Java Runtime Overview

ECLIPSE PERSISTENCE PLATFORM (ECLIPSELINK) FAQ

Learning Karaf Cellar

IBM Web Enablement for IBM i, V6.1 gives you an IT-centric entry point to SOA

Services Oriented Architecture and the Enterprise Services Bus

Anno Accademico Laboratorio di Tecnologie Web Introduzione ad Eclipse e Tomcat

Java Modularity Support in OSGi R4. Richard S. Hall ApacheCon (San Diego) December 14 th, 2005

OSGi in Action. Ada Diaconescu

Apache Felix. Richard S. Hall. A Standard Plugin Model for Apache. Atlanta, Georgia U.S.A. November 13th, 2007

Java Platform, Enterprise Edition 6 with Extensible GlassFish Application Server v3

Modular Java EE in the cloud

WSO2 Platform Offerings for Developers

16562: Liberté, Égalité, Fraternité a Mini CICS and WebSphere Revolution

Java EE 7 is ready What to do next? Peter Doschkinow Senior Java Architect

Developing Applications with Java EE 6 on WebLogic Server 12c

J2EE Development with Apache Geronimo 1.1. Aaron Mulder CTO, Chariot Solutions Committer, Apache Geronimo

Arun Gupta is a technology enthusiast, a passionate runner, and a community guy who works for Sun Microsystems. And this is his blog!

Active Endpoints. ActiveVOS Platform Architecture Active Endpoints


Apache Geronimo 3.0 Deep Dive

OSGi Application Development using GlassFish Server. Version 1.0

Oracle Corporation

First Steps in RCP. Jan Blankenhorn, WeigleWilczek GmbH, Stuttgart, Germany. February 19th, 2009

Deccansoft Software Services. J2EE Syllabus

JBoss SOAP Web Services User Guide. Version: M5

JBoss to Geronimo - EJB-Session Beans Migration

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.

WebSphere Application Server V8.0 Technical Overview

Java EE 7: Back-End Server Application Development

AppDev StudioTM 3.2 SAS. Migration Guide

J2EE Development with Apache Geronimo. Aaron Mulder Chariot Solutions

Using Apache Felix: OSGi best practices. Marcel Offermans luminis

ISV Technical Executive Forum 2011

WEBSPHERE APPLICATION SERVER

Leveraging Liberty IBM Integrated Web Application Server for i. Tim Rowe Architect Application Development

Holly Cummins Timothy Ward SAMPLE CHAPTER MANNING

Oracle - Developing Applications for the Java EE 7 Platform Ed 1 (Training On Demand)

FTM Real Time Payments installation and deployment information for Zelle

WAS: WebSphere Appl Server Admin Rel 6

SDN controller: Intent-based Northbound Interface realization for extended applications

AquaLogic BPM Enterprise Configuration Guide

JVA-163. Enterprise JavaBeans

Web Application Development Using JEE, Enterprise JavaBeans and JPA

IBM WebSphere Enterprise Service Bus V7.0, Integration Development Exam.

Patterns and Best Practices for dynamic OSGi Applications

Transcription:

Using OSGi in Modular WebSphere Applications Hannah Ramlee, IBM Software Engineer 2010 IBM Corporation

2 Cutting to the chase What: The WAS V7 Feature Pack for OSGi Applications and JPA 2.0 Why: Common Problems You ve All Seen How: OSGi and Java EE together In Standards In Open Source In the WebSphere OSGi Application Feature Pack

3 Modularization in Java Problems with Jars Java Platform Modularity Classes encapsulate data Packages contain classes Jars contain packages Class visibility: private, package private, protected, public No jar scoped access modifiers. No means for a jar to declare its dependencies. No versioning. Jars have no modularization characteristics At runtime there is just a collection of classes on a global classpath Package Jar Class Class Class Package Class Class Class Package Class Class Class

4 November 10, 2010 Problems with Global Java ClassPath Java VM log4j barcode4j axis batik commons derby fop ezmorph freemarker httpunit jakarta jcl json jdbm jdom jenks jpos18 jython looks lucene mail mx4j naming jetty poi resolver rome serializer servlets tomcat velocity ws-commons xalan wsdl4j xerces xmlgraphics xmlrpc xmlapis.. geronimo bsh bsf guiapp hhfacility manufact. marketing minerva accounting assetmaint base bi catalina common oagis order ebay content datafile ecommerce entity googlebase ofbiz widget minilang party pos. product workeffort workflow sunjce_prov. plugin jsse jce rt dnsns.. Class Not Found Exception Begin Begin Here Here

5 Problems with EARs/WARs weba.war Enterprise Apps have isolated classpaths but Across apps - each archive typically contains all the libraries required by the application Common libraries/frameworks get installed with each application Multiple copies of libraries in memory WEB-INF/classes/servletA.class WEB-INF/lib/spring.jar WEB-INF/lib/commons-logging.jar WEB-INF/lib/junit.jar webb.war WEB-INF/classes/servletB.class WEB-INF/lib/spring.jar WEB-INF/lib/commons-logging.jar WEB-INF/lib/junit.jar webc.war WEB-INF/classes/servletC.class WEB-INF/lib/spring.jar WEB-INF/lib/commons-logging.jar WEB-INF/lib/junit.jar Within apps - 3 rd party libraries consume other 3 rd party libraries leading to version conflicts plankton.v1 plankton.v2

6 OSGi Bundles and Class Loading OSGi Bundle A jar containing: Classes and resources. OSGi Bundle manifest. What s in the manifest: Bundle-Version: Multiple versions of bundles can live concurrently. Import-Package: What packages from other bundles does this bundle depend upon? Export-Package: What packages from this bundle are visible and reusable outside of the bundle? Class Loading Each bundle has its own loader. No flat or monolithic classpath. Class sharing and visibility decided by declarative dependencies, not by class loader hierarchies. OSGi framework works out the dependencies including versions. Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: MyService bundle Bundle-SymbolicName: com.sample.myservice Bundle-Version: 1.0.0 Bundle-Activator: com.sample.myservice.activator Import-Package: com.something.i.need;version="1.1.2" Export-Package: com.myservice.api;version="1.0.0"

7 OSGi Enterprise Specification Released 22 March 2010 The product of the OSGi Enterprise Expert Group (EEG) Brings Enterprise technologies and OSGi together Using existing Java SE/EE specifications: JTA, JPA, JNDI, JMX, WebApps Adds Spring-derived Blueprint component model and DI container Java EE provides the core enterprise application programming model Deploying modules as OSGi bundles simplifies reuse between applications, provides versioning, encourages (and enforces) modular design and enables dynamic module updates.

8 Enterprise OSGi in Open Source Apache Aries created as a new Apache incubator project in Sep 2009: to provide enterprise OSGi spec implementations http://incubator.apache.org/aries/ to provide an environment to collaborate and experiment with new technologies to inform further EEG standardization. In particular the programming model aspects of OSGi applications in an enterprise environment such as the Blueprint container and multi-bundle composites. to build a broad development community to encourage implementation and adoption of EEG specs Aries componentry supporting an enterprise OSGi programming model are being integrated into both Geronimo and WAS. As well as Apache Felix Karaf, JBossOSGi and others

9 Application exploitation of OSGi in WebSphere OSGi has been used internally in WAS since V6.1 and in Eclipse since R3. Application-level exploitation is introduced in the WebSphere Application Server V7 Feature Pack for OSGi Applications and Java Persistence API (JPA) 2.0 http://www-01.ibm.com/software/webservers/appserv/was/featurepacks/ Generally available May 2010 Early Program available since Nov 2009 https://www14.software.ibm.com/iwm/web/cc/earlyprograms/websphere/wasfposgiajp More downloads in a shorter period of time than any previous WAS v7 FEP open beta Two installable features: OSGi Application feature simplifies the development, assembly, and deploy of enterprise applications JPA 2.0 feature introduces Java EE 6 JPA 2.0 enhancements to object-relational persistence to simplify data access and optimize performance

10 Getting Started: Bundlizing vanilla JEE No Java code changes; war modules -> bundles Common, bundles may be easily factored out of the WARs and used at specific versions weba.war WEB-INF/classes/servletA.class WEB-INF/lib/json4j.jar WEB-INF/lib/commons-logging.jar WEB-INF/lib/junit.jar webb.war WEB-INF/classes/servletB.class WEB-INF/lib/json4j.jar WEB-INF/lib/commons-logging.jar WEB-INF/lib/junit.jar webc.war WEB-INF/classes/servletC.class WEB-INF/lib/json4j.jar WEB-INF/lib/commons-logging.jar WEB-INF/lib/junit.jar weba.wab WEB-INF/classes/servletA.class META-INF/MANIFEST.MF webb.wab WEB-INF/classes/servletB.class META-INF/MANIFEST.MF webc.wab WEB-INF/classes/servletC.class META-INF/MANIFEST.MF Import-Package Bundle Repository WEB-INF/lib/json4j.jar;version= a.b.c WEB-INF/lib/commons-logging.jar;version= WEB-INF/lib/junit.jar

11 New: Bundle Repository Config in WAS

12 Blueprint Components and Services publishes service dependencies injected consumes service A static assembly and configuration of components (POJOs) OSGI-INF/blueprint/ blueprint.xml Blueprint bundle Specifies a Dependency Injection container, standardizing established Spring conventions Configuration and dependencies declared in XML module blueprint, which is a standardization of Spring application context XML. Extended for OSGi: publishes and consumes components as OSGi services Simplifies unit test outside either Java EE or OSGi r/t. The Blueprint DI container is a part of the server runtime (compared to the Spring container which is part of the application.)

13 Exploiting Blueprint Components and Services e-commerce bundle <blueprint> <bean id= shop class= org.example.ecomm.shopimpl > <property name= billingservice ref= billingservice /> </bean> <reference id= billingservice interface= org.example.bill.billingservice /> </blueprint> e-commerce public class ShopImpl { private BillingService billingservice; void setbillingservice(billingservice srv) { billingservice = srv; } -injected service reference -service can change over time -can be temporarily absent without the bundle caring -managed by Blueprint container void process(order o) { billingservice.bill(o); } }

14 Exploiting Blueprint Components and Services Billing service bundle <blueprint> <service ref= service interface = org.example.bill.billingservice /> <bean id= service scope= prototype class= org.example.bill.impl.billingserviceimpl /> </blueprint> Billing public interface BillingService { void bill(order o); } - prototype scope indicates a new instance is created by the container for each use. - singleton scope is the default.

15 Blueprint Persistence and Transactions OpenJPA is default persistence provider in WebSphere Container managed JPA support integrated into Blueprint container: @PersistenceUnit or @PersistenceContext (managed) or <jpa:unit>, <jpa:context> bean property injection Familiar development experience for JPA developers Load-time enhancement of Entity classes Same container managed transaction attributes as EJBs: Required, RequiresNew, Mandatory, NotSupported, Supports, Never <blueprint> <bean id= shop class= org.example.ecomm.shopimpl > <jpa:context property="em" unitname="myunit"/> <tx:transaction method="*" value="required"/> </bean> </blueprint>

16 OSGi Service Registry and JNDI OSGi services are published to and looked up from OSGi service registry. From declarations in Blueprint XML Simplify integrating with existing JEE components: OSGi Services registered in the OSGi Service Registry are also available in JNDI via the osgi:service URL scheme Administered resources bound to JNDI are also published as services in the OSGi the Service Registry. The JNDI name is published as a service property called osgi.jndi.service.name

17 New: Enterprise Bundle Archive (EBA) An isolated, cohesive application consisting of a collection of bundles, is deployed as a logical unit in a.eba archive An OSGi Application. Constituent bundles may be contained ( by-value ) or referenced from a bundle repository. Services provided by the application are isolated to the application unless explicitly exposed through EBA-level application manifest Config by exception - absence of APPLICATION.MF means: application content is the set of bundles contained by-value plus any repository-hosted dependencies identified during deployment. Bundle Repository json4j.jar Application Manifest Enumerates constituent bundles Declares Application externals blog.eba blog-persistence.jar blog.jar blog-servlet.jar

18 Resolving and freezing the deployment Install ( via Admin Console / wsadmin): Application Manifest Enumerates constituent bundles Declares Application externals blog.persistence.jar blog.jar blog.eba blog.web.jar Installed Installed EBAs EBAs blog.eba blog.eba blog.persistence.jar blog.jar blog.web.jar Resolved against configured repository Bundle Repository json4j.jar Deployed result Bundle Bundle cache cache json4j.jar Deployment Manifest Fixed Deployed Result.

19 Details: Isolated and Shared Bundles In Java EE, modules are isolated within an application and applications are isolated from one another. Makes sharing modules difficult OSGi 4.2 all bundles have shared visibility to the externals of all others bundles within an OSGi framework (JVM) Makes isolating applications difficult Java EE App Server OSGi v4.2 Framework EAR 1 Module A EAR 2 Module A Isolation Module B Module C Module G Module C Sharing Everything isolated Everything shared

20 Details: Isolated and Shared Bundles Equinox 3.5 nested framework support enables composite bundles to run in isolated child frameworks WebSphere installs each OSGi Application into an isolated child framework. Shared bundles are installed into the (single) parent framework. Java EE App Server WAS V7 OSGi App FeP OSGi v4.2 Framework EAR 1 Module A Module B Module C EAR 2 Module A Module B Module C EBA 1 Bundle A Bundle B Isolated framework EBA 2 Bundle A Bundle G Isolated framework Everything isolated Bundle C Shared framework Everything shared

21 Example Blog Application Architecture Manifest-Version: 1.0 Application-ManifestVersion: 1.0 Application-Name: Aries Blog Application-SymbolicName: com.ibm.ws.eba.example.blog.app Application-Version: 1.0 Application-Content: com.ibm.ws.eba.example.blog.api;version=1.0.0, com.ibm.ws.eba.example.blog.persistence;version=1.0.0, com.ibm.ws.eba.example.blog.web;version=1.0.0, com.ibm.ws.eba.example.blog;version=1.0.0 Use-Bundle: com.ibm.json.java;version="[1.0.0,2.0.0)" isolated content shared content blog-api Web application bundle WEB-INF/ web.xml blog-servlet JNDI Blogging Service OSGI-INF/blueprint/ blueprint.xml blog Blog Persistence Service EM META-INF/ persistence.xml OSGI-INF/blueprint/ blueprint.xml blog.eba blog-persistence

22 Application-centric Bundle Management

23 OSGi and SCA: the assembly food chain Customer Component (POJO) JMS Component Application SCA Composite Warehouse Component (JEE) SCA Composite assembled from heterogeneous components including an OSGi Application component, and integrated through SCA services with configurable bindings (JMS, web services ). Bundle Application Bundle OSGi Bundles assembled in an OSGi Application and integrated through services in the OSGi service registry POJO POJO POJO Bundle POJOs assembled using a Blueprint context and scoped by an OSGi Bundle.

24 SCA integration: implementation.osgiapp Manifest-Version: 1.0 Application-ManifestVersion: Manifest-Version: 1.0 1.0 Application-Name: Application-ManifestVersion: Aries Blog 1.0 Application-SymbolicName: Application-Name: Aries Blog com.ibm.ws.eba.example.blog.app Application-Version: Application-SymbolicName: 1.0 com.ibm.ws.eba.example.blog.app Application-Content: Application-Version: 1.0 Application-Content: com.ibm.ws.eba.example.blog.api;version="1.0.0", com.ibm.ws.eba.example.blog.persistence;version="1.0.0", com.ibm.ws.eba.example.blog.api;version="1.0.0", com.ibm.ws.eba.example.blog.web;version="1.0.0", com.ibm.ws.eba.example.blog.persistence;version="1.0.0", com.ibm.ws.eba.example.blog;version="1.0.0" com.ibm.ws.eba.example.blog.web;version="1.0.0", Use-Bundle: com.ibm.ws.eba.example.blog;version="1.0.0" com.ibm.json.java;version="[1.0.0,2.0.0)" Application-ExportService: Use-Bundle: com.ibm.json.java;version="[1.0.0,2.0.0)" Application-ExportService: com.ibm.ws.eba.example.blog.blog Application-ImportService: com.ibm.ws.eba.example.blog.blog Application-ImportService: com.ibm.ws.eba.example.blog.userauthorization com.ibm.ws.eba.example.blog.userauthorization web web BlogComponent api api blog blog persistence <component name="com.ibm.ws.aries.example.blogcomponent"> <component name="com.ibm.ws.aries.example.blogcomponent"> <service name="bloggingservice"> <service name="bloggingservice"> <interface.java interface="com.ibm.ws.eba.example.blog.blog" /> <interface.java interface="com.ibm.ws.eba.example.blog.blog" /> <binding.ws <binding.ws port="http://www.blogging.org/blogservice#wsdl.endpoint(blogservice/blogservicesoap)" /> port="http://www.blogging.org/blogservice#wsdl.endpoint(blogservice/blogservicesoap)" /> </service> </service> <reference name="userauthorization"> <reference name="userauthorization"> <interface.java interface="com.ibm.ws.eba.example.blog.userauthorization" /> <interface.java interface="com.ibm.ws.eba.example.blog.userauthorization" /> </reference> </reference> <sfp:implementation.osgiapp applicationsymbolicname="com.ibm.ws.aries.example.blog.app" <sfp:implementation.osgiapp applicationsymbolicname="com.ibm.ws.aries.example.blog.app" applicationversion="1.0.0" /> applicationversion="1.0.0" /> </component> </component>

25 RAD v8 OSGi Application Project Support WAS v7 OSGi FeP Test Environment WAS v7 Server Support Publish and Run Enhanced Validation Free Eclipse Plugin for OSGi Applications Graphical tools to develop OSGi applications and bundles Includes features that increase developer productivity Creates OSGi Applications for any Aries-based server runtime. Eclipse WTP 3.6 (Helios) M6 or later required Developer Productivity (e.g. content assist, validation, re-factoring) http://www.ibm.com/developerworks/rational/downloads /10/rationaldevtoolsforosgiapplications.html Graphical Application Editor Graphical Creation Wizards Tutorials and Documentation Creation / Import / Export Tools OSGi Application Support in RAD 8.0 Provide integrated development and test of OSGi Applications on the WebSphere platform WTP PDE Eclipse OSGi Application Plugin RAD Tooling Integrated with Web Tools, JEE productivity tools, and other capabilities in RAD Supports deployment to WAS v7 OSGi FeP and includes the FeP in the WAS Test Environment Enhanced validation http://www-01.ibm.com/software/awdtools/ developer/application/index.html

26 RAD OSGi Application Project Support

27 Key OSGi Feature Pack benefits Modular and Extensible Applications Problem: Complex Java EE applications rely on good development practice to deliver the modular designs required to reduce maintenance cost and promote extensibility. Solution: The feature pack simplifies the development and deployment of reusable application modules, exploiting application-level OSGi infrastructure integrated into the server runtime. Problem: Multiple Java EE applications using the same libraries each install their own isolated copies of these libraries Solution: OSGi applications can be assembled to resolve against libraries in a shared repository, reducing disk and memory footprint Problem: Application using 3 rd party libraries have little control over the dependencies these libraries have and can suffer from versioning conflicts between different libraries. Solution: OSGi bundle versioning enables multiple versions of the same library to be loaded concurrently within a server Development Simplicity Leverage Spring-like simplicity, including unit test of business components outside the server, but governed by OSGi standards and integrated with proven Java EE technologies WebSphere integrated to deliver enterprise scalability, management and QoS Optionally composeable as SCA components into SOA applications

28 Questions?

29 Word association architecture

30 Copyright and Trademarks IBM Corporation 2010. All rights reserved. IBM, the IBM logo, ibm.com and the globe design are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml. Other company, product, or service names may be trademarks or service marks of others.