Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Operations and Monitoring with
Spring
Eberhard Wolff
Regional Director and Principal
Consultant
SpringSource
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 2
A Short History of Spring
•  Spring is a platform independent framework for the
development of (Enterprise) Java Applications
•  Originally started as an easier to use alternative for
Java EE development
•  In particular compared to EJB
•  See "J2EE Development Without EJB"
•  But actually there is more to it
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 3
Programming Model vs.
Infrastructure
•  Programming Model:
A set of APIs to use as a developer
•  Infrastructure:
Something to run your software on
•  Spring defines a Programming Model but no
Infrastructure
•  …you can use Java EE, a simple Servlet container…
•  Java EE defines a Programming Model and an
Infrastructure
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 4
Bundling Programming Model
and Infrastructure
•  Bundling leads to some problems
•  To upgrade the programming model you need to
upgrade the infrastructure
•  Operations will not like that idea
•  You are limited to a certain infrastructure – what do
you do concerning OSGi?
•  You only get the benefit from OSGi if you use its non
OSGi deployment model
•  Users realize how flexible they are using Spring
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 5
Spring s Impact on Java EE
Production Environment
Jaav EE Application Server
Servlet Container
• Connection mgmt.
• Clustering
• Deployment management
EJB Container
EAR
EJB
WAR
Production Environment
Tomcat
Production Environment
Java EE Application Server
Servlet Container
• Connection mgmt.
• Clustering
• Deployment management
WAR
Spring
Powered
Application
Spring
WAR
Spring
Powered
Application
Spring
Servlet Container
• Connection mgmt.
• Clustering
• Deployment management
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 6
So: What is the advantage of
Spring over Java EE 6?
•  Type error: Cannot compare infrastructure +
programming model to programming model
•  But seriously…
•  Spring actually exists – Java EE 6 is still being
standardized
•  You don't need to upgrade your server (many are
still on Java EE 5)
•  Actually this question is not important to many:
They don't run on Java EE anyway
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 7
0% 10% 20% 30% 40% 50% 60% 70%
Java Application Server Usage, Source: 2008 Evans Data Survey
Spring ApplicationsWebLogic 26%
JBoss 38%
WebSphere 43%
Apache Tomcat 68%
Today s De Facto Standards
Spring and Tomcat
•  Obviously the Java EE platform is often not needed
•  A Servlet container is enough
•  …and too complex
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 8
Is Spring + Servlet container
as powerful as Java EE?
•  "Classic" features of a Java EE server
Feature Spring Solution
Transactions No real 2PC but smart solutions for many
scenarios
Security Spring Security is much better
Distribution Not too important any more
Spring Remoting offers even more features
Persistence Java EE's persistence (JPA) can be used –
and several other
Naming Supported by Dependency Injection
Connection / Resource
Pooling
Supported by Servlet Containers and
DataSource implementations
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 9
So…
•  Let's add transaction support (JTA) to Tomcat
•  Then we have a full blown Application Server
•  But Tomcat is very successful already
•  …and Spring offers solutions
–  for O/R mappers
–  for JMS + a DataSource
•  JTA seems to be a not too important
•  Is there anything else we need to think about?
•  Infrastructure is not just for developers!
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 10
Operations
•  Operations cares about
–  monitoring
–  administration
•  They should be able to look into application
•  Usually there is more than one Application Server –
how can you handle larger installations?
•  Individual updates of parts of an application are
important
•  Virtualization / Cloud
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Spring Enterprise -
Looking into Applications
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 12
Your Application
Spring Enterprise -
Looking into Applications
•  Certified Spring
•  Instrumented
Spring
–  Monitor Spring
apps across
infrastructure
•  JMX flows into
Management
Application
–  Track app
performance
•  Just different
JARs
•  No code changes
Enterprise
Management
Application
JMX
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Demo: Spring Enterprise
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Handling large clusters
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 15
Cluster
•  Usually there is more than one Tomcat server in an
installation
•  How can you manage them?
•  Ideally centralized
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 16
tc Server
Tomcat
Enterprise
support
Distributed
Operations
Diagnostics
Enterprise
Capabilities
Tomcat you know. Enterprise capabilities you need.
SpringSource tc Server
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 17
Product Architecture
tc Server machine 1
Hyperic
Agent
Mgmt
Server
Hyperic
Server
Hyperic
Web
Console
Other Manageable Items
Apache http Server
Apache Tomcat
ActiveMQ
JVM
Operating Systems
Scripts
Configs
Inventory,
Metric,
Audit, …
tc
Server
tc Server machine n
Hyperic
Agent
Configs
tc
Server
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 18
tc Server
•  Binaries almost unchanged – no lock in
•  Centralized monitoring and administration
•  Groups of server allow to deal with a group of
servers – not just one
–  Start / stop / restart
–  Deployment
–  Configuration including JVM options
•  Easy operations of large Tomcat installations
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Demo: tc Server
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 20
Demo
WhiteRabbit
Hyperic
Agent
Ubuntu1
Hyperic
Server
Hyperic
Web
Console
Inventory,
Metric,
Audit, …
tc
Server
Ubuntu1
Hyperic
Agent
tc
Server
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Updating parts of an application
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 22
dm Server
•  Modularization is key to maintainable software
•  Modularization at runtime gives more power to
Operations
•  Updates of parts of the application
•  Determining the source of an error
•  etc
•  On the client and in the embedded world OSGi has
succeeded as a standard for modularization
•  OSGi enters the server market…
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
OSGi
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 24
It's a module system
•  Partition a system into a number of modules –
"bundles"
•  Dynamic: Bundles can be installed, started, stopped,
uninstalled and updated
•  ...at runtime
•  better operations
•  Strict visibility rules
•  Resolution process satisfies dependencies of a
module
•  Understands versioning
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 25
It's even service-oriented
•  Bundles can publish services… dynamically!
•  Service Registry allows other bundles to consume
services
•  Services come and go at runtime
–  … transparently when using Spring-DM
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 26
OSGi Bundle
•  The fundamental unit of deployment and
modularity in OSGi
•  Just a JAR file
–  with additional entries in META-INF/MANIFEST.MF
•  Common manifest headers:
–  Bundle-SymbolicName
–  Bundle-Version
–  Bundle-Name
–  Bundle-ManifestVersion
–  Bundle-Vendor
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 27
Import / Export -Package
Declares package-level dependencies of your
bundle.
Import-Package: com.xyz.foo;
Import-Package:
com.xyz.foo;version="1.0.3"
Import-Package:
com.xyz.foo;version="[1.0.3,1.0.3]"
Import-Package:
com.xyz.foo;version="[1.0.3,1.1.0)",
com.xyz.bar;version="[1.0.3,2.0.0)"
Export-Package: com.xyz.foo
Export-Package: com.xyz.foo;version="1.0.5"
>= 1.0.3; e.g.,
1.0.3.GA, 1.0.4,
etc.
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Spring Dynamic Modules &
SpringSource dm Server
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 29
Spring-DM:
ApplicationContext
•  Configuration files in /META-INF/spring
•  Automatically merged
•  ..and ApplicationContext is created
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 30
Service export and import
<beans ...>
<osgi:service ref="customerDAO"
interface="dao.ICustomerDAO" />
<osgi:reference id="dataSource"
interface="javax.sql.DataSource" />
</beans>
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 31
Service export and import
•  Dynamic services automatically dealt with
•  i.e. method calls are buffered
•  Purely declarative
•  No dependencies on OSGi in the code
•  No resource leaks
•  Not solved in Spring Dynamic Modules:
–  Easy import of libraries
–  Using JPA or Hibernate in OSGi
–  Seamless Web Support
–  Notion of an application
•  Enter dm Server
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 32
dm Server Platform
• Modular profiles
• Bundle repository
• Library provisioning
• Serviceability
– FFDC
– Logging / Tracing
• Built on Equinox
• Modular architecture
– Subsystems
– Bundles
• Small footprint
WAR
Personality
Web Module
Personality
Bundle
Personality
Tomcat Deployer Management
Dynamic Modules Kernel
Equinox
JVM
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 33
Bundles for the example
•  Web
•  Service
•  API: only interfaces and domain
classes
–  Implementation can be exchanged
•  Could add infrastructure:
DataSource /
PlatformTransactionManager
API
Service
Web
Package
Import
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 34
Bundles & Types
•  Only dependencies to the API
•  Therefore: implementation can be exchanged even
at runtime
•  No direct dependencies to any implementation
•  Not shown: dependencies to external bundles
•  … can be installed in dm Server
•  … modular middleware!
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 35
Bundles & Services
Services:
Publish /
Consume
api
service
web Service
Registry
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 36
Bundles & Services
•  Infrastructure can use the same principle as
application services
•  i.e. DataSource and
PlatformTransactionManager are just another
service
•  Can I still run on plain Java EE?
•  Yes: instead of OSGi Service directly inject
Spring Beans
•  no more more dynamic services / modularization
•  No code change needed
•  Application can run on Java EE or OSGi
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 37
PAR
•  Packaging format for all
modules in an application
•  JAR with Application-*
manifest headers
•  Single unit: deploy,
refresh, undeploy
•  Application boundaries
–  Scoping of types and
services
–  DataSource does not leak
out of the application
–  Hibernate can change
domain objects
API
Service
Web
Package
Import
Spring
Taglibs
Application
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Web Migration: From WAR to
PAR
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 39
Shared Libraries WAR
Web Application Deployment
Options
•  Standard Java EE WAR
–  supported on dm Server as is
–  converted into an OSGi
bundle
•  Shared Libraries WAR
–  WAR + OSGi package imports
–  Eradicate library bloat of
monolithic Java EE
–  WARs
•  Shared Services WAR
–  Uses OSGi services
with Spring's
<osgi:reference>
•  Web Module
Standard WAR
libs
services Bundle
Repository
Shared Services WAR
OSGi
Service
Registry
services
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Roadmap
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 41
dm Server 2.0 Roadmap
•  SpringSource dm Server 2.0: 2009
•  Cloning bundles
–  solves problems around static variables and more
•  Shared Repository
–  make a repository available to other servers
•  Plan Files
–  Define an application as a collection of bundles
–  Does not contain the bundles, more flexible
•  Distributed and improved Management
–  operation on a group of servers
–  like tc Server for Tomcat
•  Modular Web Applications
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 42
Support for Enterprise OSGi
Standards
•  RFC 66: Web Container for OSGi (RI based on dm
Server)
•  RFC 119: Distributed OSGi
•  RFC 124: Blueprint Service (RI based on Spring-
DM)
•  RFC 139: JMX interface for OSGi
•  RFC 142: JNDI and OSGi integration
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 43
Note: OSGi has an impact on
operations
•  New deployment model
•  Updates of bundles possible
•  How much less regression testing do you actually
do?
•  Is redeploying just a part of an application OK for
operations?
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 44
Virtualization / Cloud
•  Deployment blueprints define machines and their
characteristics
•  vApp define a deployment format based on such
blueprints
•  dm Server, tc Server etc will be configurable using
vApp properties (e.g. ports)
•  vApps can be pre defined – just add your application
•  vApps can optimize for network traffic or availability
•  Deployment and set up of the VMs is trivial
•  …in your private or a public cloud
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Summary
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 46
Summary
•  Spring is a portable programming model
•  This help the move from full blown Java EE to
Servlet containers
•  An important part of infrastructures is support for
operations
•  Issues:
–  Monitoring e.g. Spring Enterprise
–  Cluster e.g. tc Server
–  Modularization at runtime e.g. OSGi / dm Server
–  Virtualization / Cloud
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Questions?
Eberhard Wolff
eberhard.wolff@springsource.com
http://SpringSource.com
Run	
  
Manage	
  
Build	
  

Operations and Monitoring with Spring

  • 1.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. Operations and Monitoring with Spring Eberhard Wolff Regional Director and Principal Consultant SpringSource
  • 2.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 2 A Short History of Spring •  Spring is a platform independent framework for the development of (Enterprise) Java Applications •  Originally started as an easier to use alternative for Java EE development •  In particular compared to EJB •  See "J2EE Development Without EJB" •  But actually there is more to it
  • 3.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 3 Programming Model vs. Infrastructure •  Programming Model: A set of APIs to use as a developer •  Infrastructure: Something to run your software on •  Spring defines a Programming Model but no Infrastructure •  …you can use Java EE, a simple Servlet container… •  Java EE defines a Programming Model and an Infrastructure
  • 4.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 4 Bundling Programming Model and Infrastructure •  Bundling leads to some problems •  To upgrade the programming model you need to upgrade the infrastructure •  Operations will not like that idea •  You are limited to a certain infrastructure – what do you do concerning OSGi? •  You only get the benefit from OSGi if you use its non OSGi deployment model •  Users realize how flexible they are using Spring
  • 5.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 5 Spring s Impact on Java EE Production Environment Jaav EE Application Server Servlet Container • Connection mgmt. • Clustering • Deployment management EJB Container EAR EJB WAR Production Environment Tomcat Production Environment Java EE Application Server Servlet Container • Connection mgmt. • Clustering • Deployment management WAR Spring Powered Application Spring WAR Spring Powered Application Spring Servlet Container • Connection mgmt. • Clustering • Deployment management
  • 6.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 6 So: What is the advantage of Spring over Java EE 6? •  Type error: Cannot compare infrastructure + programming model to programming model •  But seriously… •  Spring actually exists – Java EE 6 is still being standardized •  You don't need to upgrade your server (many are still on Java EE 5) •  Actually this question is not important to many: They don't run on Java EE anyway
  • 7.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 7 0% 10% 20% 30% 40% 50% 60% 70% Java Application Server Usage, Source: 2008 Evans Data Survey Spring ApplicationsWebLogic 26% JBoss 38% WebSphere 43% Apache Tomcat 68% Today s De Facto Standards Spring and Tomcat •  Obviously the Java EE platform is often not needed •  A Servlet container is enough •  …and too complex
  • 8.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 8 Is Spring + Servlet container as powerful as Java EE? •  "Classic" features of a Java EE server Feature Spring Solution Transactions No real 2PC but smart solutions for many scenarios Security Spring Security is much better Distribution Not too important any more Spring Remoting offers even more features Persistence Java EE's persistence (JPA) can be used – and several other Naming Supported by Dependency Injection Connection / Resource Pooling Supported by Servlet Containers and DataSource implementations
  • 9.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 9 So… •  Let's add transaction support (JTA) to Tomcat •  Then we have a full blown Application Server •  But Tomcat is very successful already •  …and Spring offers solutions –  for O/R mappers –  for JMS + a DataSource •  JTA seems to be a not too important •  Is there anything else we need to think about? •  Infrastructure is not just for developers!
  • 10.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 10 Operations •  Operations cares about –  monitoring –  administration •  They should be able to look into application •  Usually there is more than one Application Server – how can you handle larger installations? •  Individual updates of parts of an application are important •  Virtualization / Cloud
  • 11.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. Spring Enterprise - Looking into Applications
  • 12.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 12 Your Application Spring Enterprise - Looking into Applications •  Certified Spring •  Instrumented Spring –  Monitor Spring apps across infrastructure •  JMX flows into Management Application –  Track app performance •  Just different JARs •  No code changes Enterprise Management Application JMX
  • 13.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. Demo: Spring Enterprise
  • 14.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. Handling large clusters
  • 15.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 15 Cluster •  Usually there is more than one Tomcat server in an installation •  How can you manage them? •  Ideally centralized
  • 16.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 16 tc Server Tomcat Enterprise support Distributed Operations Diagnostics Enterprise Capabilities Tomcat you know. Enterprise capabilities you need. SpringSource tc Server
  • 17.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 17 Product Architecture tc Server machine 1 Hyperic Agent Mgmt Server Hyperic Server Hyperic Web Console Other Manageable Items Apache http Server Apache Tomcat ActiveMQ JVM Operating Systems Scripts Configs Inventory, Metric, Audit, … tc Server tc Server machine n Hyperic Agent Configs tc Server
  • 18.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 18 tc Server •  Binaries almost unchanged – no lock in •  Centralized monitoring and administration •  Groups of server allow to deal with a group of servers – not just one –  Start / stop / restart –  Deployment –  Configuration including JVM options •  Easy operations of large Tomcat installations
  • 19.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. Demo: tc Server
  • 20.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 20 Demo WhiteRabbit Hyperic Agent Ubuntu1 Hyperic Server Hyperic Web Console Inventory, Metric, Audit, … tc Server Ubuntu1 Hyperic Agent tc Server
  • 21.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. Updating parts of an application
  • 22.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 22 dm Server •  Modularization is key to maintainable software •  Modularization at runtime gives more power to Operations •  Updates of parts of the application •  Determining the source of an error •  etc •  On the client and in the embedded world OSGi has succeeded as a standard for modularization •  OSGi enters the server market…
  • 23.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. OSGi
  • 24.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 24 It's a module system •  Partition a system into a number of modules – "bundles" •  Dynamic: Bundles can be installed, started, stopped, uninstalled and updated •  ...at runtime •  better operations •  Strict visibility rules •  Resolution process satisfies dependencies of a module •  Understands versioning
  • 25.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 25 It's even service-oriented •  Bundles can publish services… dynamically! •  Service Registry allows other bundles to consume services •  Services come and go at runtime –  … transparently when using Spring-DM
  • 26.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 26 OSGi Bundle •  The fundamental unit of deployment and modularity in OSGi •  Just a JAR file –  with additional entries in META-INF/MANIFEST.MF •  Common manifest headers: –  Bundle-SymbolicName –  Bundle-Version –  Bundle-Name –  Bundle-ManifestVersion –  Bundle-Vendor
  • 27.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 27 Import / Export -Package Declares package-level dependencies of your bundle. Import-Package: com.xyz.foo; Import-Package: com.xyz.foo;version="1.0.3" Import-Package: com.xyz.foo;version="[1.0.3,1.0.3]" Import-Package: com.xyz.foo;version="[1.0.3,1.1.0)", com.xyz.bar;version="[1.0.3,2.0.0)" Export-Package: com.xyz.foo Export-Package: com.xyz.foo;version="1.0.5" >= 1.0.3; e.g., 1.0.3.GA, 1.0.4, etc.
  • 28.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. Spring Dynamic Modules & SpringSource dm Server
  • 29.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 29 Spring-DM: ApplicationContext •  Configuration files in /META-INF/spring •  Automatically merged •  ..and ApplicationContext is created
  • 30.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 30 Service export and import <beans ...> <osgi:service ref="customerDAO" interface="dao.ICustomerDAO" /> <osgi:reference id="dataSource" interface="javax.sql.DataSource" /> </beans>
  • 31.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 31 Service export and import •  Dynamic services automatically dealt with •  i.e. method calls are buffered •  Purely declarative •  No dependencies on OSGi in the code •  No resource leaks •  Not solved in Spring Dynamic Modules: –  Easy import of libraries –  Using JPA or Hibernate in OSGi –  Seamless Web Support –  Notion of an application •  Enter dm Server
  • 32.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 32 dm Server Platform • Modular profiles • Bundle repository • Library provisioning • Serviceability – FFDC – Logging / Tracing • Built on Equinox • Modular architecture – Subsystems – Bundles • Small footprint WAR Personality Web Module Personality Bundle Personality Tomcat Deployer Management Dynamic Modules Kernel Equinox JVM
  • 33.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 33 Bundles for the example •  Web •  Service •  API: only interfaces and domain classes –  Implementation can be exchanged •  Could add infrastructure: DataSource / PlatformTransactionManager API Service Web Package Import
  • 34.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 34 Bundles & Types •  Only dependencies to the API •  Therefore: implementation can be exchanged even at runtime •  No direct dependencies to any implementation •  Not shown: dependencies to external bundles •  … can be installed in dm Server •  … modular middleware!
  • 35.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 35 Bundles & Services Services: Publish / Consume api service web Service Registry
  • 36.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 36 Bundles & Services •  Infrastructure can use the same principle as application services •  i.e. DataSource and PlatformTransactionManager are just another service •  Can I still run on plain Java EE? •  Yes: instead of OSGi Service directly inject Spring Beans •  no more more dynamic services / modularization •  No code change needed •  Application can run on Java EE or OSGi
  • 37.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 37 PAR •  Packaging format for all modules in an application •  JAR with Application-* manifest headers •  Single unit: deploy, refresh, undeploy •  Application boundaries –  Scoping of types and services –  DataSource does not leak out of the application –  Hibernate can change domain objects API Service Web Package Import Spring Taglibs Application
  • 38.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. Web Migration: From WAR to PAR
  • 39.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 39 Shared Libraries WAR Web Application Deployment Options •  Standard Java EE WAR –  supported on dm Server as is –  converted into an OSGi bundle •  Shared Libraries WAR –  WAR + OSGi package imports –  Eradicate library bloat of monolithic Java EE –  WARs •  Shared Services WAR –  Uses OSGi services with Spring's <osgi:reference> •  Web Module Standard WAR libs services Bundle Repository Shared Services WAR OSGi Service Registry services
  • 40.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. Roadmap
  • 41.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 41 dm Server 2.0 Roadmap •  SpringSource dm Server 2.0: 2009 •  Cloning bundles –  solves problems around static variables and more •  Shared Repository –  make a repository available to other servers •  Plan Files –  Define an application as a collection of bundles –  Does not contain the bundles, more flexible •  Distributed and improved Management –  operation on a group of servers –  like tc Server for Tomcat •  Modular Web Applications
  • 42.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 42 Support for Enterprise OSGi Standards •  RFC 66: Web Container for OSGi (RI based on dm Server) •  RFC 119: Distributed OSGi •  RFC 124: Blueprint Service (RI based on Spring- DM) •  RFC 139: JMX interface for OSGi •  RFC 142: JNDI and OSGi integration
  • 43.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 43 Note: OSGi has an impact on operations •  New deployment model •  Updates of bundles possible •  How much less regression testing do you actually do? •  Is redeploying just a part of an application OK for operations?
  • 44.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 44 Virtualization / Cloud •  Deployment blueprints define machines and their characteristics •  vApp define a deployment format based on such blueprints •  dm Server, tc Server etc will be configurable using vApp properties (e.g. ports) •  vApps can be pre defined – just add your application •  vApps can optimize for network traffic or availability •  Deployment and set up of the VMs is trivial •  …in your private or a public cloud
  • 45.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. Summary
  • 46.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. 46 Summary •  Spring is a portable programming model •  This help the move from full blown Java EE to Servlet containers •  An important part of infrastructures is support for operations •  Issues: –  Monitoring e.g. Spring Enterprise –  Cluster e.g. tc Server –  Modularization at runtime e.g. OSGi / dm Server –  Virtualization / Cloud
  • 47.
    Copyright 2009 SpringSource.Copying, publishing or distributing without express written permission is prohibited. Questions? Eberhard Wolff eberhard.wolff@springsource.com http://SpringSource.com Run   Manage   Build