deploying java ee 6 apps in a cluster: glassfish 3.1 at dallas tech fest 2011
DESCRIPTION
Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011TRANSCRIPT
![Page 1: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/1.jpg)
1
GlassFish Server 3.1Deploying your Java EE 6 Applications in Cluster
Arun Gupta, Java EE & GlassFish Guyblogs.oracle.com/arungupta, @arungupta
![Page 2: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/2.jpg)
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.
![Page 3: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/3.jpg)
Java EE 6 and GlassFish Server 3
shipped final releases on
December 10th 2009
![Page 4: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/4.jpg)
World's First Java EE 6 Compatible
App Server with
Clustering & High Availability
Shipped Feb 28th 2011
![Page 5: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/5.jpg)
GlassFish Server Chronology*
GlassFish v1
Java EE 5, Single Instance
2006 …
GlassFish v2
Java EE 5, High Availability
GlassFish Server 3.1
Java EE 6, High Availability
GlassFish Server 3
Java EE 6, Single Instance
2007 2008 2009 2010 2011
* GlassFish Server Open Source Edition
GlassFish 3.1.1
JDK7 support
GlassFish.next
Java EE 7
![Page 6: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/6.jpg)
GlassFish Community
● Proven by developers● Over 24 million downloads
● Over 22 million active users (cumulative in
past 4 yrs)
● 900K+ upgrades from GlassFish Server 3 to
3.1 in just 2 months
● Active user forums
● Sub-projects– Jersey (JAX-RS), Metro (JAX-WS), Grizzly (nio),
Atmosphere, OpenMQ (JMS), and more
![Page 7: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/7.jpg)
GlassFish Around You
http://maps.glassfish.org
![Page 8: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/8.jpg)
Deliverables
● Application Server● Open Source and high-quality runtime
● Java EE 5 / 6 Reference Implementation, early
access to latest standards
● Clustering and High Availability
● Full Commercial Support from Oracle
● Continued Investment in Open Source● Open Source license, governance, participation,
transparency, ...
![Page 9: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/9.jpg)
General Picture of Distributions
![Page 10: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/10.jpg)
WebLogic Server
Production Java Application Deployment
GlassFish Server
Production Java Application Deployment
• Best open source application server with support from Oracle
• Open source platform of choice for light-weight Web applications
• Focus on latest Java EE standards and community driven innovation
• Certified interoperability with Fusion Middleware
• Differentiated innovation, scout thread
•Best commercial application server for transactional Java EE applications
•Platform of choice for standardization
•Focus on lowest operational cost and mission critical applications
•integration with Oracle Database, Fusion Middleware & Fusion Applications
GlassFish and WebLogic together
![Page 11: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/11.jpg)
●Auto-deploy of all Java EE and static
artifacts
Painless Java EE development !The save/reload paradigm
![Page 12: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/12.jpg)
Active Deployment
● Deployment option to maintain stateful
sessions across re-deployments
$ asadmin redeploy --properties
keepSessions=true myapp.war
● Greatly simplifies the
development paradigm
● Integrated in IDEs
![Page 13: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/13.jpg)
Yes, Eclipse too !
OEPE : http://www.oracle.com/technetwork/developer-tools/eclipse
![Page 14: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/14.jpg)
Introducing GlassFish Server 3
![Page 15: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/15.jpg)
3.1 Overview
● Built on GlassFish 3
● Modular and Extensible HK2 Kernel
● ~260+ modules
● Clustering and High Availability
● HTTP, EJB, IIOP, SSO, Metro
● Dynamic Invocation of Services
● End-to-end extensibility
![Page 16: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/16.jpg)
Fast and Furious ...
● 29% better startup/deploy/re-deploy cycle
over 3.0.1
● 33% better HA performance over 2.1.1
● Scalable Grizzly Adapter based on Java NIO
● Full-session and Modified-attribute* scope
● Multiple Standalone instances and Clusters
per domain
http://weblogs.java.net/blog/sdo/archive/2011/03/01/whats-new-glassfish-v31-performance
![Page 17: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/17.jpg)
Modular and Dynamic
●Modular : Apache Felix (OSGi)
●Extensible : HK2
●Yet very Fast !
![Page 18: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/18.jpg)
![Page 19: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/19.jpg)
More Painless Development
● Fast auto-deploy of all Java EE and static artifacts
● Application runner
● java -jar glassfish.jar toto.war
● Maven integration
● mvn gf:run, gf:start, gf:deploy,
...
● Containers added dynamically and transparently
● Excellent Tools support
![Page 20: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/20.jpg)
Embedded uses
● Testing
● EJBContainer API (EJB 3.1)
● Simple testing using Java SE (JUnit, Maven, ...)
using EJB container
● Packaging / Bundling
● Beyond the specification: control all of GlassFish
Server with an API = GlassFish Embedded
● Integration testing & ship the server inside the
app
![Page 21: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/21.jpg)
What's the deal with OSGi?
● GlassFish Server runs on top of OSGi (Felix)
● Also runs unmodified on Equinox (and Knopflerfish)
● GlassFish ships as 260+ bundles
● Can run without OSGi (Static mode)
● Can use OSGi management tools (CLI or Web)
● Can be installed on top of existing OSGi runtime
● Any OSGi bundle will run in GlassFish Server
● Drop it in glassfish/modules{/autostart}
● Can also asadmin deploy it using --type osgi
● GlassFish OSGi admin console
![Page 22: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/22.jpg)
Extending GlassFishOSGi-style – an example, a demo and a picture
● OSGi declarative service
● Service-Component entry in the JAR Manifest
● Invoke the service from a
servlet using standard
@Resource injection
● Never use a GlassFish API !
● No need to chose between
OSGi and
Java EE
Step by step: http://blogs.sun.com/dochez/entry/glassfish_v3_extensions_part_4
![Page 23: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/23.jpg)
Update Center
![Page 24: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/24.jpg)
Monitoring and ManagementBeyond web console and asadmin
● Dynamic and non-intrusive monitoring
● BTrace integration
– Portable, dynamic and safe tracing tool for Java
– Btrace annotations and API to write scripts
● Java-defined Probe Providers
● RESTful interface
● DTrace for end-to-end
● JavaScript Monitoring tool (add-on)
● Still exposed via JMX
● jconsole and visualvm as natural clients
![Page 25: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/25.jpg)
RESTful Administration
● Jersey + Grizzly to provide REST interfaces
● Configure runtime (via GET, POST, DELETE)
● Invoke commands (restart, stop, deploy, etc..)
● Monitoring (GET only)
● Available from
● http://localhost:4848/management/domain
● http://localhost:4848/monitoring/domain
● Use REST clients as Admin GUI substitute
● Use your favorite glue/scripting language or tool
● Data offered as either XML, HTML or JSON
● Extensible
![Page 26: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/26.jpg)
More GlassFish Server 3.x
● Developer performance
● Embedded API
● RESTful API
● Update Center
● Metro 2.0
● OpenMQ 4.x
● Admin console
● Btrace monitoring
● ...
![Page 27: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/27.jpg)
GlassFish Server Users
![Page 28: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/28.jpg)
Customers Around the Globe
Depend on WebLogicIn government…
On the phone …
In the wallet …
With health …
In education and
research …
In travel &
transport …
![Page 29: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/29.jpg)
GlassFish Server 3.1Developer Highlights
● Developer Productivity–Improved embedded API support
–Updated NetBeans and Eclipse plugin
● Updated Technologies–Grizzly WebSocket support
–Improved CDI, JSON, hypermedia support in Jersey
–Technology refresh – JSF, CDI, Grizzly, OSGi, JPA,Jersey, Bean Validation, Metro, UC, etc.
–Implementation of various Enterprise OSGi Specs
![Page 30: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/30.jpg)
GlassFish Server 3.1Clustering Highlights
●HTTP, EJB, IIOP, SSO, Metro–New - RM Sequence, Secure Conversations
●Session-based replication using Shoal–Distributes session state uniformly & consistently among instances
●Shoal OSGi module, loaded when HA-enabled apps are deployed
●Support for conventional clustering of MQs brokers in embedded mode
![Page 31: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/31.jpg)
GlassFish Server 3.1Manageability Highlights
●SSH based remote management and provisioning
●Application versioning support
●Application scoped resources
●Statement leak detection and reclaim
●Improved monitoring
●Console based on RESTful API
![Page 32: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/32.jpg)
Application Versioning
● Deploy multiple versions of an application, only one enabled
● Commands● asadmin deploy foo.war
●asadmin deploy –name=foo:BETA-1 foo.war●asadmin deploy –name=foo:BETA-1.1
–enable=false foo.war
●asadmin enable foo:BETA-1.1
●asadmin deploy –name=foo:RC1 foo.war
●asadmin undeploy foo:BETA*
●asadmin undeploy foo:*
![Page 33: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/33.jpg)
GlassFish Server 3.1.1
● Runs on JDK 7
● Extensive platform support
● AIX 6.1/7.1, Solaris 11 Express Edition
● Better performance with 64-bit LB plug-in
● Performance and Stability enhancements
● Weld, Bean Validation, Jersey, …
● Support for OSGi/Java EE Hybrid Apps
● Improved fidelity for GlassFish Embedded
![Page 34: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/34.jpg)
String in switch – Before JDK 7@Path("fruits")public class FruitResource {
@GET@Produces("application/json")@Path("{name}")public String getJson(@PathParam("name")String name) {
if (name.equals("apple") || name.equals("cherry") || name.equals("strawberry"))return "Red";
else if (name.equals("banana") || name.equals("papaya"))return "Yellow";
else if (name.equals("kiwi") || name.equals("grapes") || name.equals("guava"))return "Green";
else if (name.equals("clementine") || name.equals("persimmon"))return "Orange";
elsereturn "Unknown";
} . . .
![Page 35: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/35.jpg)
String in switch – After JDK 7@Path("fruits")public class FruitResource {
@GET@Produces("application/json")@Path("{name}")public String getJson(@PathParam("name")String name) {
switch (name) {case "apple": case "cherry": case "strawberry":
return "Red";case "banana": case "papaya":
return "Yellow";case "kiwi": case "grapes": case "guava":
return "Green";case "clementine": case "persimmon":
return "Orange";default:
return "Unknown";}
} . . . http://blogs.oracle.com/arungupta/entry/totd_168_string_switch_statement
![Page 36: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/36.jpg)
Automatic Resource
Management – Before JDK 7@Resource(name=“jdbc/__default”)DataSource ds;
@javax.annotation.PostConstructvoid startup() {
Connection c = null;Statement s = null;try {
c = ds.getConnection();s = c.createStatement();
// invoke SQL here
} catch (SQLException ex) {System.err.println("ouch!");
} finally {try {if (s != null)
s.close();if (c != null)
c.close();} catch (SQLException ex) {System.err.println("ouch!");;
}}
}
![Page 37: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/37.jpg)
Automatic Resource
Management – After JDK 7@Resource(name=“jdbc/__default”)DataSource ds;
@javax.annotation.PostConstructvoid startup() {
try (Connection c = ds.getConnection(); Statement s = c.createStatement()) {
// invoke SQL here
} catch (SQLException ex) {System.err.println("ouch!");
}}
http://blogs.oracle.com/arungupta/entry/totd_167_automatic_resource_management
![Page 38: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/38.jpg)
Multi-catch – Before JDK 7protected void doPost(HttpServletRequest request, HttpServletResponse response){
PrintWriter out = null;try {
response.setContentType("text/html;charset=UTF-8");out = response.getWriter();out.println("<html><head><title>Servlet TestServlet</title></head>");out.println("<body>");out.println("<h1>Sending email from " + request.getContextPath () + "</h1>");
for (Part p : request.getParts()) {// save the parts locallySystem.out.println(p.getName() + " saved");
}
Message message = new MimeMessage(session);message.setFrom(new InternetAddress(from));InternetAddress[] address = {new InternetAddress(to)};message.setRecipients(Message.RecipientType.TO, address);message.setSubject("File upload successful.");message.setSentDate(new Date());message.setText("File has been successfully saved.");Transport.send(message);
out.println("</body>");out.println("</html>");
} catch (ServletException ex) {Logger.getLogger(TestServlet.class.getName()).log(Level.SEVERE, null, ex);
} catch (MessagingException ex) {Logger.getLogger(TestServlet.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {Logger.getLogger(TestServlet.class.getName()).log(Level.SEVERE, null, ex);
} finally {out.close();
}
![Page 39: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/39.jpg)
Multi-catch – After JDK 7
out.println("</body>");out.println("</html>");
} catch (ServletException | MessagingException | IOException ex) {Logger.getLogger(TestServlet.class.getName()).log(Level.SEVERE, null, ex);
} finally {out.close();
}
http://blogs.oracle.com/arungupta/entry/totd_169_multi_catch_using
![Page 40: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/40.jpg)
GlassFish Server Control
Performance TunerDAS Backup & RecoveryMonitoring
Scripting Client
Coherence Active Cache Oracle AccessManager Integration
Load BalancerPlugin & Installer
![Page 41: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/41.jpg)
Strategy for continued success
● Continue to deliver outstanding performance
● Continue to improve developer productivity
● Continue product execution
● Deliver Java EE 7 first
● Deliver on product roadmap
● Continue to innovate
● Improve manageability
● Hybrid OSGi / Java EE applications
![Page 42: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/42.jpg)
Why Attend JavaOne
Because Duke says:
• “Find out what's new with Java Technology.”
• “Hear from and network with visionary speakers and recognized community luminaries.”
• “Get in-depth technical content and hands-on learning opportunities that cover today's most important Java development topics.” (400+ sessions/BoFs/HOLs)
• “Walk away with improved working knowledge and coding expertise you can apply immediately to your own projects and initiatives.”
http://oracle.com/javaone
![Page 43: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/43.jpg)
References
● oracle.com/javaee
● glassfish.org
● oracle.com/goto/glassfish
● blogs.oracle.com/theaquarium
● youtube.com/GlassFishVideos
● Follow @glassfish
![Page 44: Deploying Java EE 6 Apps in a Cluster: GlassFish 3.1 at Dallas Tech Fest 2011](https://reader034.vdocument.in/reader034/viewer/2022042700/555c260bd8b42a09438b4c91/html5/thumbnails/44.jpg)
44
GlassFish Server 3.1Deploying your Java EE 6 Applications in Cluster
Arun Gupta, Java EE & GlassFish Guyblogs.oracle.com/arungupta, @arungupta