43
<Insert Picture Here> ©2011 Oracle Corporation Modern, Lightweight Development and Java EE 6 Alexis Moussine-Pouchkine http://blogs.oracle.com/theaquarium, @alexismp

Modern, lightweight development with Java EE 6

Embed Size (px)

Citation preview

Page 1: Modern, lightweight development with Java EE 6

<Insert Picture Here>

©2011 Oracle Corporation

Modern, Lightweight Development and Java EE 6 Alexis Moussine-Pouchkine http://blogs.oracle.com/theaquarium, @alexismp

Page 2: Modern, lightweight development with Java EE 6

The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions.

The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

©2011 Oracle Corporation 2

Page 3: Modern, lightweight development with Java EE 6

©2011 Oracle Corporation 3

Terminology

•  What does “Modern” Development mean? •  The obvious: leveraging recent innovation •  Balancing of cutting and bleeding edge •  Simpler, easier to use

•  What does “Lightweight” Development mean? •  What you want, not more than what you want

•  Smaller runtime memory footprint •  Easy install and download •  Less deployment unit / library bloat •  Decoupling container – application dependencies

Page 4: Modern, lightweight development with Java EE 6

©2011 Oracle Corporation 4

•  Choice –  Your tool selection, your dev/test environment, your

persistence provider •  Productivity

–  IDEs (or not), lots of OSS Libraries / Frameworks •  Familiarity

–  Standard-based with extension points, not proprietary •  Simplicity

–  Leaner, POJO driven API with annotations •  Quality

–  Facilitate Agile and Test Driven Development •  Agility

–  Server Modularity, Extensibility, Linked Portfolio

Modern and Lightweight is not enough

Page 5: Modern, lightweight development with Java EE 6

©2011 Oracle Corporation

Developer Productivity

Flexible, Lightweight Extensible

Web Profile API Pruning

Injection

Embrace open source frameworks Enables Drag & Drop framework installation

More annotations, better IDEs POJO development

Less XML configuration

Java EE

Java EE 6 meets and exceeds those requirements

Page 6: Modern, lightweight development with Java EE 6

Java EE 7: Cloud Foundation

•  Formalize new roles, PaaS, multi-tenancy •  Pluggable cloud services •  Revision of underlying Java EE specs

Page 7: Modern, lightweight development with Java EE 6

©2011 Oracle Corporation

Agenda

Modern, Lightweight approaches in Java EE6:

!  Development Approach

!  Developer Tools

!  Build Environment, Continuous Integration

!  Testing, Diagnostics, Tuning

!  Modular Runtime Services

!  Easier Web Application Packaging

!  New Approaches to Persistence

!  Conclusion

Page 8: Modern, lightweight development with Java EE 6

Use Lightweight, Testable Plain Old Java Objects

•  Less configuration complexity

•  Easier testability and alignment with OS tools –  Ant / Maven / Hudson

•  Java EE 6 makes advances in this area –  (CDI) Context and

Dependency Injection –  EJB 3.1, JPA –  JSF 2.0 (Beans, etc) –  Java EE will only

continue to improve •  Caching with clusterable

hashmaps becoming the norm

©2011 Oracle Corporation

Managed Beans

JPA 2

Context Dependency & Injection

JSF2

EJB 3.1

JAX-RS

JAX-WS

Persistence

Facelets

JSR 330

Basic Component

Presentation

Dependency Injection

Business Services

REST

SOAP

Caching In-memory grid

Page 9: Modern, lightweight development with Java EE 6

Developer Tools

Page 10: Modern, lightweight development with Java EE 6

•  A comprehensive, modular IDE >  First to support Java SE 7 >  Best-in-Class support for Java EE 6 >  GlassFish 3.1.1 support, WebLogic 10.3.4 >  Extensive dynamic language support (PHP,

Ruby, Groovy, etc.) >  Connected Developer improvements >  Intuitive workflow, Java FX, Swing, C++ >  Debugger, Profiler, Refactoring, etc.

•  A platform for building applications >  RCP = Rich Client Platform >  Modular architecture allows easy reuse >  Rich framework of windows, menus, tool bars,

actions

•  A thriving open source community >  Large set of 3rd party plug-ins >  Over 20 Million Downloads >  Over 100 Partner Companies >  Active blogging community

NetBeans IDE

©2011 Oracle Corporation

Page 11: Modern, lightweight development with Java EE 6

Artifact

AppXRay™

Presentation

Component

Data Access

External Resources

JSP CSS JSF ADF Faces HTML TLD

Faces Config POJO Resource

bundles XML

schema Java

Variable

Java / Java EE / ADF

Oracle Coherence

WebLogic, GlassFish

Spring, ORM, DB, JPA

Spring DAO

EJB 3 JPA POJO Eclipse

Link

Oracle Enterprise Pack for Eclipse Free Eclipse Plug-ins for Fusion Middleware

12 ©2011 Oracle Corporation

Page 12: Modern, lightweight development with Java EE 6

•  Excellent Multi Language Support –  Java 7, JavaScript, Ruby, Groovy, HTML, CSS, XML –  Recognizes languages inside of other languages

•  Strong Refactoring, Source Editing •  Very current support of 3rd party technology

–  Maven, Groovy, Spring, Flex, Android, Ruby, Python, Scala, PHP

•  Great for Java •  May not be the best for Java EE, relative to other options

–  GlassFish / WebLogic Server plug-ins are tricky –  Comparatively less Java EE wizards –  No EE javadoc code completion in the editor

IntelliJ IDEA

©2011 Oracle Corporation

Page 13: Modern, lightweight development with Java EE 6

•  Editors were always lightweight, but perhaps not modern

Text Editors (VI, Emacs, VIM, UltraEdit, etc)

©2011 Oracle Corporation

+/- No IDE project model to conform to + Good for any programming language (usually) + Doesn’t even show up on corporate architecture radar

- No integrated debugging, wizards, validation - Search and replace ≠ refactoring, D-I-Y codegen - Potentially lots of ongoing work to configure

Page 14: Modern, lightweight development with Java EE 6

Build Environment, Continuous Integration

Page 15: Modern, lightweight development with Java EE 6

F/OSS Java tools ecosystem Leverage free and open source software

©2011 Oracle Corporation 16

Hudson

Dependency Management

Tools

Automation Tools

Tracking Tools

Version Control Tools

Testing

Continuous Integration

Tools

WebLogic

GlassFish

Page 16: Modern, lightweight development with Java EE 6

Maven, if you can Build and Dependency Management

•  Maven wants to control everything, including directory structure •  If your project can work with the constraints, Maven will: •  Enable repeatable builds •  Embed build knowledge into the project •  Make it possible to create automated builds •  Enable CI •  Can enforce uniform project setup •  No need to have all developers script their own build.xml files •  No duplication of build code •  Simplify dependency management •  A lot of plug-ins available

©2011 Oracle Corporation

Page 17: Modern, lightweight development with Java EE 6

Maven Repo URI

•  glassfish:create-domain •  glassfish:start-domain •  glassfish:deploy •  glassfish:redeploy •  glassfish:undeploy •  glassfish:stop-domain •  glassfish:delete-domain

http://download.java.net/maven/glassfish/

Maven with WebLogic and GlassFish

©2011 Oracle Corporation

GlassFish •  wls:install* •  wls:create-domain* •  wls:start-server* •  wls:deploy •  wls:undeploy •  wls:re-deploy •  wls:start-app •  wls:list-apps •  wls:stop-app •  wls:wlst (run script) •  wls:stop-server*

WebLogic

* Coming in Java EE 6 Release

Page 18: Modern, lightweight development with Java EE 6

An agile imperative: Hudson CI Continuous integration

•  Written in Java, has IDE plug-ins •  Works on any Java container •  No install required, java –jar hudson.war!•  Easy to use, browser based config •  REST API and CLI •  Vibrant Ecosystem of 330+ plug-ins

–  GlassFish Plug-in –  Coming soon: WebLogic Plug-in

•  How it works: –  Dev commits – which triggers a build –  Hudson detects changes, checks out code –  Builds project on another machine –  Organizes Build Output (libs, docs, installers) –  Records and Publishes results –  Feedback – only when necessary

©2011 Oracle Corporation

Page 19: Modern, lightweight development with Java EE 6

Testing, Diagnostics, Tuning

Page 20: Modern, lightweight development with Java EE 6

Test Driven Development

refactor Commit updates

Add test

Make small change

Commit updates

©2011 Oracle Corporation

•  Small steps •  Frequent check-ins •  Design for

testability •  Interface first, then

implement •  Mock objects

Page 21: Modern, lightweight development with Java EE 6

Category Tool Continuous Integration Hudson/Jenkins, CruiseControl, Continuum Acceptance FitNesse, Selenium Load Test JMeter, Eclipse TPTP Coverage Cobertura, Emma Web Apps Selenium, HttpUnit Java EE Servers Cargo, Cactus, Arquillian Database DBUnit Mock Objects jMock, EasyMock, Mockito Unit tests JUnit, TestNG Build Ant, Maven, Ivy Race/Deadlock JRockit Mission Control Profiling JRockit Mission Control, NetBeans Memory Leak JRockit Mission Control

U N I T T E S T I N G

©2011 Oracle Corporation

Lots of F/OSS to leverage when in development

Page 22: Modern, lightweight development with Java EE 6

Deploy

Profiling & performance

tuning

Regression testing

Troubleshooting

Monitoring

Alerts & triggers

23 ©2011 Oracle Corporation

Plug-in to leverage when in deployment: JRMC JRockit Mission Control and JRockit Flight Recorder

Operations

Production

diagnostics

Development

Page 23: Modern, lightweight development with Java EE 6

JRockit Flight Recorder ”Black box”

24 ©2011 Oracle Corporation

Mission Control Server

1.  A serious failure occurs •  JVM crash •  Out of memory •  Application terminates unexpectedly •  Hardware failure or power outage

2.  Buffered data is saved to a file •  Contents include both in-memory and on-

disk buffer data •  Exception: HW failure will only yield on-

disk data 3.  User opens file in JRMC for analysis

In-memory/on-disk buffer

Page 24: Modern, lightweight development with Java EE 6

Flight Recorder ”Real-time Application Diagnostics”

Mission Control Server

1.  Monitoring system detects an issue •  Too long JSP response time •  Unexpected memory growth •  (anything exposed through JMX)

2.  JRMC requests diagnostics data •  “Give me all diagnostics data leading up to the issue”

3.  Data is sent to JRMC •  Analyze immediately (manual or automatic) •  And/or store for later analysis

In-memory/on-disk buffer

Page 25: Modern, lightweight development with Java EE 6

Flight Recorder Benefits

•  Always available – No need to instrument application – No runtime overhead

•  Dramatically decrease time & cost for troubleshooting –  Both in-house and when working with Oracle Support

•  Enable positive feedback loop in production – Collect data from all SLA breaches –  Analyze, fix, update application, repeat until no more

errors

•  Improved datacenter performance & availability

Page 26: Modern, lightweight development with Java EE 6

Modular Runtime Services

Page 27: Modern, lightweight development with Java EE 6

Rich Features in a Lightweight Runtime

•  Pay for what you use –  Starts in seconds –  Features dynamically loaded as needed, like …

•  … Administration console •  … EJB container, embedded JMS server •  … Web services container •  … Clustering

•  Standard distributions of Java EE Servers becoming the norm –  Java EE 6 Web Profile –  Full Java EE 6 – Minimize runtime to avoid the need to build custom platform

©2011 Oracle Corporation

Page 28: Modern, lightweight development with Java EE 6

Java EE Server Modularity

Application Container Runtime Container Kernel

Con

tain

er S

DK

Deployment

Configuration

NIO

Monitoring

AdminGUI

Application Container Runtime Approach Taken on WebLogic Server and GlassFish

©2011 Oracle Corporation

Page 29: Modern, lightweight development with Java EE 6

What Does it Mean to Developers?

•  Expect to see lighter weight distributions of Java EE Servers – GlassFish Server Web Profile – 29M

•  Expect to see runtime profiles – WebLogic Server having runtime Web Profile support turning

off EJB, JMS and JCA containers

•  Expect to see experimentation with OSGi programming models – GlassFish OSGi/Java EE Hybrid specifications and

implementation •  e.g. JPA, EJB, JDBC, JTA, ... as OSGi services

•  We need your feedback as to how important this is for Java EE 7 and 8 going forward

©2010 Oracle Corporation 30

Page 30: Modern, lightweight development with Java EE 6

Easier Web Application Packaging

Page 31: Modern, lightweight development with Java EE 6

Simplified Packaging of Web Applications

WEB-INF/classes com/acme/MyServlet.class com/acme/MyFilter.class

WEB-INF/web.xml

index.html main.css jquery-1.4.2.js ui/jquery.ui.core.js ui/jquery.ui.widget.js

WEB-INF/lib someframework.jar

Web Application

Page 32: Modern, lightweight development with Java EE 6

Simplified Packaging of Web Applications

WEB-INF/classes com/acme/MyServlet.class com/acme/MyFilter.class

index.html main.css jquery-1.4.2.js ui/jquery.ui.core.js ui/jquery.ui.widget.js

Web Application

@WebServlet(urlPatterns=”/foo”)public class MyServlet { … }

@WebFilter(urlPatterns=”/foo”)public class MyFilter { … }WEB-INF/lib

someframework.jar

Page 33: Modern, lightweight development with Java EE 6

Simplified Packaging of Web Applications

WEB-INF/classes com/acme/MyServlet.class com/acme/MyFilter.class

WEB-INF/lib someframework.jar

index.html main.css jquery-1.4.2.js ui/jquery.ui.core.js ui/jquery.ui.widget.js

Web Application

META-INF/web-fragment.xml com/fw/FwServlet.class com/fw/FwFilter.class

Framework Jar

Page 34: Modern, lightweight development with Java EE 6

Simplified Packaging of Web Applications

WEB-INF/classes com/acme/MyServlet.class com/acme/MyFilter.class

WEB-INF/lib someframework.jar jquery-ui-1.8.4.jar

index.html main.css

Web Application

META-INF/resources/jquery-1.4.2.js META-INF/resources/ui/jquery.ui.core.js META-INF/resources/ui/jquery.ui.widget.js

jQuery Resource Jar

Page 35: Modern, lightweight development with Java EE 6

Simplified Packaging of Web Applications

WEB-INF/classes com/acme/MyServlet.class com/acme/MyFilter.class

WEB-INF/lib someframework.jar jquery-ui-1.8.4.jar

index.html main.css

Web Application

•  Self-contained •  Generic •  Reusable

Page 36: Modern, lightweight development with Java EE 6

New approaches to persistence

Page 37: Modern, lightweight development with Java EE 6

New approaches to structured storage

©2011 Oracle Corporation

RDBMS

• Ubiquitous • Newer, higher level

APIs

In-memory Data Grids • Mature • Distributed storage,

processing, and caching

NRDBMS (noSQL)

• Emerging • Often distributed

Page 38: Modern, lightweight development with Java EE 6

A quick look at Java Persistence API 2.0

•  Why JPA and not other Java persistence methods? –  Incredible productivity gain using annotations –  Reduce errors from repetitive coding with lower level APIs –  Standard, not proprietary – many providers exist –  Integration point for in-memory data grid –  JPA 2.0’s ORM can handle real life database schemas

•  JPA in a nutshell –  Concrete classes (POJOs) –  No required interfaces or inheritance –  new() for instance creation –  Mapping using annotations and/or XML –  “Managed” by an EntityManager –  Can leave the Container (“detached”)

©2011 Oracle Corporation

Page 39: Modern, lightweight development with Java EE 6

A quick look at in-memory caching

•  Why an in-memory data grid? –  For public internet scale –  For solid-state response times –  Processing large event volumes

•  In-memory data grid in a nutshell – Container-less Clustering of Java Processes – Data Structures to manage Data across a Cluster / Grid – Real-Time Event Observation – Listener Pattern – Materialized Views of Data –  Parallel Queries and Aggregation – Object-based Queries –  Parallel Data Processing –  Parallel Grid Processing – RemoteException Free Distributed Computing

©2011 Oracle Corporation

Page 40: Modern, lightweight development with Java EE 6

A quick look at NRDBMS (a.k.a NoSQL)

•  Why NRDBMS? –  indexing a large number of documents –  serving data intensive pages at commercial internet loads –  delivering streaming media –  when you can sacrifice data consistency for performance

•  NRDBMS in a nutshell –  Document store, graph, key-value store, multivalue

databases, OODBMS, Tabular, Tuple Store –  May not require fixed table schemas –  Usually avoid joins –  Scale horizontally

©2011 Oracle Corporation

Page 41: Modern, lightweight development with Java EE 6

Conclusion

Page 42: Modern, lightweight development with Java EE 6

©2011 Oracle Corporation 43

•  Enterprises need commercial support & services •  Commercial upgrade options abound •  Contractual Technical Support & ProServ

•  Agile often means projects have unforeseen futures •  Having a linked commercial portfolio means you aren’t stuck in a point solution

•  Enterprises need platforms with healthy ecosystems •  Java EE and open source are constantly inspiring each other, and should be considered together

•  Java EE6 meets the requirements out of the box •  Together with F/OSS for testing, quality, troubleshooting

•  Server extensibility means your investment will survive the: •  Next point solution •  Next cool language that is narrow in scope

Conclusion: Java EE 6 is best for enterprise

Page 43: Modern, lightweight development with Java EE 6

<Insert Picture Here>

©2011 Oracle Corporation