GlassFish and the Future of
Java EE
Carol McDonald
Java Architect
Sun Microsystems, Inc.
1
Agenda
Java EE 5 Overview
GlassFish v2 – Today
Java EE 6 and Future
GlassFish v3 – The Future
Summary and Resources
History of Enterprise Java Ease of
Development
6 Java EE 5
Web Ease of
Services
5 Development
J2EE 1.4 Annotations
` Web Services, EJB 3.0
4 Robustness
Management, Persistence API
Enterprise Java J2EE 1.3 Deployment, New and
Platform Updated
3 CMP, Async.
Connector Web Services
Connector
J2EE 1.2 Architecture
JavaServer Faces
2
Servlet, JSP,
EJB, JMS
1 JPE
RMI/IIOP
Project
0
May 1998 Dec 1999 Sept 2001 Nov 2003 March 2005
Java EE 5 Overview
Java EE 5.0 Summary
How is it easier?
J2EE 1.4 Java EE
Deployment Java language
descriptors annotations @
Required container Plain Old Java
interfaces Objects (POJOs)
JNDI Lookups Dependency
Injection
Deployment
descriptor, interfaces More and better
defaults
No Supported UI
Framework Java Server Faces
(JSF)
Catalog Sample Java EE Application
Registration Application
Managed Bean Entity Class
Item DB
ManagedBean Catalog
Session Bean
JSF Components
Entity Classes
Use JPA to map/retrieve data from the database as
Java Object
Item
ID NAME DESC URL
@Entity
public class Item {
@Id
int id;
String name;
String descr;
String url;
}
Catalog Statelesst eSession EJB, JPA Query e p e n d e n c y
S t a l e s s S e s s io n D In j e c t io n
B e a n A n n o t a t io n
@Stateless
public class Catalog implements CatalogService {
@PersistenceContext(unitName=”PetCatalogPu”)
EntityManager em;
@TransactionAttribute(NOT_SUPPORTED)
public List<Item> getItems(int firstItem,
int batchSize) {
Query q = em.createQuery
("select i from Item as i");
q.setMaxResults(batchSize);
q.setFirstResult(firstItem);
List<Item> items= q.getResultList();
return items;
}
}
Catalog Sample Java EE Application
Registration Application
Managed Bean Entity Class
Item DB
ManagedBean Catalog
Session Bean
JSF Components
Managed Bean: ItemController
public class ItemController {
D e p e n d e n c y In j e c t io n
private DataModel model;
private int batchSize = 10;
private int firstItem = 0;
@EJB private CatalogService catalog;
public DataModel getItems() {
model = new ListDataModel(
catalog.getItems( firstItem,batchSize);
return model;
}
...
Demo Netbeans 6.5 JPA entity JSF
pages generation from DB tables
Java EE 5 Web
Services
Catalog Sample JAX-WS Application
Registration Application
Managed Bean Entity Class
Item DB
SOAP
ManagedBean Catalog EJB
Web Service Web Service
JSF Components
Client
Catalog EJB Web Service
@WebService
@Stateless
public class Catalog implements CatalogService
public List<Item> getItems{
...
}
}
public methods become web service operations
WSDL/Schema generated at deploy time
automatically
D e p e n d e n c y In j e c t io n
Web Service Client
public class ItemController {
@WebServiceRef(wsdlLocation="http://host/Catalog/Service?wsdl")
private CatalogService service;
public DataModel getItems() {
// Call Web Service Operation
service.Catalog port = service.getCatalogPort();
List<Item> result = port.getItems(first, size);
return new ListDataModel(result);
}
}
Glassfish and MySQL Part 3
Demo
Netbeans 6.5 Glassfish v2
JAX-WS
RESTful Web Services with
JAX-RS
(JavaEE 6 but in Glassfish v2)
RESTful Catalog
RIA App REST DataBase
Registration Application Persistence-tier
Web Services
JAX-RS class Entity Class
Item DB
HTTP
ItemsConverter
ItemsResource
JAXB class
JavaFX
RESTful Catalog Web Service
HTTP GET
http://petstore/catalog/resources/items/
Ad d re s s a b l
e
Client
Re s o u rc e s
Response XML items
Server We b
<item> C o n t a in e r
<imageurl>http://host/catalog/images/anthony.jpg</imageurl>
<name>Friendly Cat</name>
<price>307.10</price>
<productid>feline01</productid>
</item>
JAX-RS: Clear mapping to REST concepts
High level, Declarative
Uses @ annotation in POJOs
Resources: what are the URIs?
@Path("/items/{id}")
Methods: what are the HTTP methods?
@GET
public XXX find()
Representations: what are the formats?
@Consumes("application/xml")
@Produces("application/json")
RESTful Catalog
Items Resource retrieves updates a collection of Item entities
/items – URI for a list of Items
Registration Application
Item resource retrieves or updates one Item entity
/item/1 – URI for item 1
JAX-RS class Entity Class
Item DB
HTTP
ItemsConverter
ItemsResource
JAXB class
JavaFX
Get Items resource
responds to the URI http://host/catalog/items/
@Path("/items/") method
public class ItemsResource { responds to HTTP GET
Representation
@GET
@Produces("application/json") responds with JSON
public ItemsConverter get(){
return new ItemsConverter(
getEntities());
}
Performs JPA
Query, returns list
of entities
Glassfish and MySQL Part 4
Demo
Netbeans 6.5 Glassfish v2
JAX-RS
GlassFish V2
What is GlassFish ?
Its a A Community
Users, Partners, Testers, Developers, ...
Started in 2005 on java.net
Application Server
Enterprise Quality and Open Source (CDDL & GPL v2)
Java EE 5 v2 Java EE 6 v3
Full Commercial Support from Sun
Timeline of Project GlassFish
Tomcat
Jasper
Catalina
v3
JSTL
Struts v1 v2 Prelude v3
GlassFish
Crimson UR1 UR2
Launch v2.1
XSLTC
Xalan
Xerces
JAXB June May Sept. Nov Dec Mid-2009
JAX-RPC
2005 2006 2007 2008 2008
JSF
GlassFish Adoption
8M million downloads in the
last year
150k registrations in 7 months
Dozens of external committers
Active Usage
Over 7,000 members
2000000
Strong and growing partner 1800000
1600000
ecosystem 1400000
1200000
1000000
800000
600000
400000
200000
0
Fe Ma Ap Ma Ju Jul Au Se Oc No De Ja
b r r y n 07 g p t v c n
07 07 07 07 07 07 07 07 07 07 08
GlassFish V2
Features
GlassFish v2: Web-based Administration
GlassFish v2 for Enterprises
Management & Monitoring
Graphical, command-line, tools, ANT ...
JMX and Centralized
Call Flow
Self-management
Diagnostic reports
GlassFish v2 for Enterprises
Management & Monitoring
Graphical, command-line, tools, ANT ...
JMX and Centralized
Call Flow
Self-management
Diagnostic reports
Ease-of-use – Update Center
SPECjAppServer 2004 Results
Best-In-Class Performance 1000
900
SPECjAppServer
800
700
?
600
500
July 2007 Record setting performance 400
300
200
10% faster than BEA WebLogic 9.2 on identical 100
server
0
Sun BEA IBM JBos
Fastest complete open source result
GlassFish v2, OpenSolaris, Java 6, PostgreSQ
Best Price Performance Ever
2% cost of Dell, 5% cost of HP (Oracle)
13 times better price/performance
Web Services SOAP, Security, Reliability
.NET interoperability
Commons
SMTP
Security Reliability Transactions ...
Spring
JSON
SOAP WSDL HTTP
Web Services Core
JAXB JAXP SAAJ ...
XML Processing
Metro – GlassFish Web Services Stack
metro.dev.java.net
Dynamic Languages & Frameworks
Ajax Framework
http://glassfish-scripting.dev.java.net jMaki
GlassFish v2: IDE Support
Clustering And Load Balancing
HTTP(S) JMS RMI/IIOP
Runtime
Cluster
Message Routing / Failover / Load Balancing member
discovery &
health
Management
monitoring
AS AS AS AS AS AS
Instances
Clustered
through
. . . AS Shoal
Node A Node B Node C
HA Application State Repository
Memory Replication for High Availability
Example: Maximize
Availability on 4 instance
Typical cluster topology cluster on 2
nodes(machines)
Instance 1 Instance 2
Instance 3 Instance 4
Machine 1 Machine 2
Comet:
the server pushes data to the client over a
long-lived HTTP connection
GlassFish supports Comet
Serve
r
Client Client
1 2
Ajax Push and HTTP keep-alive
Comet:
server pushes data to
the client over a
previously opened
connection
HTTP/1.1 Keep-Alive
or Persistent
Connection:
keeps connection
open until message
or timeout
Long Poll: Send a request to the server,
request waits for an event, then response sent
GlassFish Grizzly Comet
NIO:
non-blocking sockets
ARP Asynchronous Request Processing:
Doesn't block a thread per http request
availability of threads gives scalability
Demo
Comet Slide Show
Allows creation of event-driven web application which are
hosted in browser
RESTful Web Services and Comet
http://developers.sun.com/appserver/reference/techart/cometslideshow.html
GlassFish Eco-System
OpenESB
JBI support
OpenESB 2.0
Install, admin, and monitoring
integrated in GlassFish v2
Basis for Java CAPS Release 6
Tools support
NetBeans SOA 6.0
Service Engines
Binding Components
Many components available from
https://open-esb.dev.java.net/Components.html
Extended GlassFish: OpenSSO
Open SSO:
Single Sign On Web Access Identity Federation
Management
Extended GlassFish
OpenPortal
Standards: Portlets (2.0), Web Services for Remote
Portlets, Identity: OpenSSO
https://portal.dev.java.net/
OpenDS
100% Java LDAPv3 Directory Service
https://opends.dev.java.net/
The SailFin Project
Bridging the HTTP and
SIP protocols
Ericsson SIP Servlet
Contribution is available
at:
http://sailfin.dev.java.net
Visit, Download, Try, Join
Milestone 1 available
Built on GlassFish v2
(Some) Distributions & Contributors
Java EE SDK
GlassFish
Enterprise
Derby
MQ
Project
GlassFish
Portal Server
Open ESB
Users and Other Groups
GlassFish Partners
Targeted at ISVs, Hosting partners & Other solution
providers
Profile in Partner Showcase
Banner Advertising on GlassFish community and blogs
Training Discounts
Requirements
Customer-ready support for GlassFish
Associate-level member in SPA
Java EE 6 and Future
Java EE Timeline Profiles
Java EE 6
EJB Lite
Ease of
Restful WS
Development
Web Beans
Java EE 5 Extensibility
Web Ease of
Services
Development
J2EE 1.4 Annotations
` Web Services,
Robustness EJB 3.0
Management, Persistence API
Enterprise Java J2EE 1.3 Deployment, New and
Platform
CMP, Async. Updated
Connector
J2EE 1.2 Connector Web Services Java EE 6
Servlet, JSP, Architecture Web Profile
JPE EJB, JMS
Project RMI/IIOP
Major new Features in Java EE 6
Profiles
targeted bundles of technologies
1st profile is the Web profile
Pruning
older technologies optional
CMP, JAX-RPC...
Extensibility
Zero-configuration, drag-and-drop for web
frameworks
Ease of development
Full JSRs
Java EE 6 EJB 3.1
JPA 2.0
New Features Servlet 3.0
Profiles JSF 2.0
Pruning JAX-RS 1.0
Extensibility Connector 1.6
More ease of development Bean Validation 1.0
Web Beans
Maintenance JSRs
JAXB 2.2
JAX-WS 2.2
JSR-109 1.3
EL 1.2
JSP 1.2
Authentication SPI 1.1
Common Annotations 1.1
Ease Of Development
Ongoing concern
focus is the web tier
General principles:
Annotation-based programming model
web.xml not required
Self-registration of third-party libraries
Simplified packaging
Web Profile
Servlet 3.0,
JSP 2.1, JSR-45 (Debugging), EL 1.2, JSTL 1.2,
JSF 2.0
EJB Lite 3.1, JTA 1.1,
JPA 2.0,
JSR-250 (Annotations)
EJB “Lite”
Small subset of EJB 3.1 API for use in Web Profile
Lite
Local Session Beans
Also requires JPA 2.0 /
JTA 1.1 API
Simplified Packaging
EJB components can be packaged directly inside a
web application archive (war file)
Some Servlet 3.0 Highlights
Annotation-based programming model
@WebServlet @ServletFilter etc.
Async APIs
Useful for Comet, chat rooms, long waits
Some JavaServer Faces 2.0 Features
custom components easier to develop
Ajax support
Html templates (Facelets)
Reduce configuration
Bookmarkable URLs
Some EJB 3.1 Highlights
Singleton beans: @Singleton
No interface view: one source file per bean
Calendar timers:
@Schedule(dayOfWeek=“Mon,Wed”)
Async business methods: @Asynchronous
Simplified testing (embeddable test outside
container)
Session Bean with
Local Business Interface...OLD...
HelloBean Client <<interface>
com.acme.Hello
@EJB String sayHello()
private Hello h;
...
h.sayHello(); com.acme.HelloBean
public String
sayHello() { ...
}
Session Bean with
no Interface
@Stateless
public class HelloBean {
public String sayHello(String msg) {
return “Hello “ + msg;
}
}
no Interface client...NEW...
@EJB HelloBean h;
...
h.sayHello(“bob”);
Timeline
June 2007 Expert group formed
Q3 2008 Public draft
Q4 2008 Proposed final draft
Q2 2009 Final release
GlassFish V3 – The Future
GlassFish v3
Java EE 5 = GlassFish v2
GlassFish v2.1: better, faster, more scalable
GlassFish v3 Prelude
Web Tier Only, OSGi Based, some EE 6 previews
EclipseLink (JPA) Bundled
Multiple Containers (jRuby, Groovy, Phobos)
GlassFish v3 = Java EE 6
Work in Progress
OSGi Based
All have Netbeans and Eclipse Integration
What's new in V3
Modularity
OSGi runtime (Apache Felix)
Lightweight, Fast StartUp, Scalable
Service based architecture
services are defined by contracts and can be
easily substituted
lazy loading based on usage patterns
Extensible
not limited to traditional Java EE containers
Embeddable
Runs in-VM
GlassFish v3
JavaEE 6 and Frameworks
All JVM-Scripting Languages
small to HA to Communication to Grid
Preview available today
GlassFish v3 Architecture
Portlet Groovy JRuby OpenMQ OpenESB OpenSSO
Container JMS
Web Connection Java
Container JSF Pooling (JCA) Metro EJB Container
Persistence
Management Console Update Center Management CLI
Naming Grizzly Framework Monitoring/
Injection Configuration Serviceability/
Service Manager Logging
GlassFish V3 Core
Security (Module Subsystem)
Transaction Deployment Clustering
Management Service
OSGi
NetBeans Java SE JavaWebStart
GlassFish v3 Runtime
GlassFish v3 is an OSGi application
GFv3 is de-composed into a set of modules
Modules are run inside OSGi container (Apache
Felix)
user-defined
Webtier EJB Scripting JCAPS …
modules user-defined
…
modules
GlassFish Kernel
(HK2, API, etc.)
Felix runtime
Compile/Deploy on Change
Java EE development doesn't have to be painful
Incremental compile of all Java EE artifacts
Auto-deploy of all Java EE and static artifacts
Session retention: maintain stateful sessions across re-
deployments
v3 Prelude Usage
xWiki
GlassFishV3
Project Fuji JavaDB
SailFin (OpenESB.next)
(Telco AppServer)
WebSynergy
(Portal, Liferay)
EHCache Server WebEngine
GlassFish v3 Embedded GlassFish v3 Embedded
Jersey Jersey
GlassFish v3 Roadmap
V3 Prelude
Today!
V3 Final aligned with Java EE 6
Starting a series of Milestone releases
Targeted for Fall 2009
Clustering, central admin likely on the update center
V3.1 full clustering
Likely 6 to 9 months after V3
0 comments
Post a comment