GlassFish Application Server
An IntroductionBy
Jumping Bean21 May 2012
Who Am I?
● Mark Clarke – Java Developer● Working for Jumping Bean, an open source
solutions integration company● Working with Java & open source
technologies since 2001● Co-founder of Jozi JUG
Jozi JUG
● Meet once a month in Johannesburg,● Talk● Beer● Pizza● All FREE!● Where to find us?
– Meetup
– Web Site
GlassFish History
● 6 June 2005 – Glassfish launched by SUN– based on Sun Java System Application
Server PE 9
– TopLink persistence code donated by Oracle.
● 4 May 2006 – Version 1 JEE 5 RI - aimed at developers
● 17 Sep 2007 – Version 2 Clustering, MS interop web services. Aimed at enterprise
GlassFish History
● 10 Dec 2009 – Version 3 Java EE6 RI. Introduced OSGI, fast startup & redeploy on change.
– New architecture,
Recent Releases
● Version 3.1 shipped Feb 28th 2011– ssh-based provisioning, centralised admin,
clustering & load balancing (reintroduced)
● Version 3.1.1 shipped Jul 2011– Bug fix release
● Version 3.1.2 shipped Feb 2012 – – bug fixes, new admin console features, new
thread pool properties, transaction recovery from database
GlassFish Versions
● Oracle Glassfish Server – Oracle supported version,
– Based on Open Source Edition + some closed source bits,
– Similar to SUN's Glassfish Enterprise Server
● Glassfish Open Source Edition– GPL or CDDL
– Community Supported
GlassFish Versions
● Certified interoperability with Oracle Fusion Middleware products:
– Oracle Internet Directory,
– Oracle Virtual Directory,
– Oracle, WebLogic Server,
– Oracle Access Manager
● Includes Oracle GlassFish Server Control for improved manageability and performance of production deployments
GlassFish Adoption
● World wide - 23,257,762 active users,● South Africa – 268,449 active users.
* from maps.glassfish,org/server
Installing GlassFish
● Zip package – No configuration wizard
– Update tool must be installed manually
– Manual uninstall
● Self-extracting bundle – GUI installer, installer can be used to perform
configuration after installation,
– Can do silent mode installs, useful for scripting
– Option to install Update Tool,
– Uninstaller provided
Installing/Upgrading GlassFish
● Update tool– Used to update server components,
– Install additional functionality
– Graphical & command line (pkg)
– In place upgrades
Why GlassFish?
● Easy to administer with GUI,● Cluster wide management and deployment,● Load balancing,● Centralised administration,● Support for the latest web services specs +
interoperability with Microsoft WCF,
Why GlassFish?
● Developer productivity,● Modular architecture
– Extensible
– Embeddable
● Support for multiple languages● In place upgrade.● Built-in, fine-grained, monitoring
Developer Productivity
● Fast startup times● User friendly Admin console interface,● Excellent tooling
– Netbeans,● Compile on Save● Deploy on Change
– Eclipse,
– Maven support,
– IntelliJ,
● Scriptable via command line interface
GlassFish Architecture
● Kernel – hundred kilobyte kernel
– Startup/shutdown sequence
– Basic service deployment
– Reading config
● Services cross container functionality– Security, JNDI
– Admin Console
GlassFish Sub-Projects
● HK2 Kernel – hundred kilobyte kernel
● Grizzly – NIO based network listeners/connectors http
● OSGi – Used for module system, swappable Apache
Felix or Knoperfish
● Tomcat – (modified) for servlet container
GlassFish Architecture
● Jersey – Provides REST Web Service functionality
● Metro – Web service stack, SOAP etc● Shoal – Clustering framework● Majorra – JSF● OpenMQ – Message Service
Embedded
● Testing – EJBContainer API (EJB 3.1)
– Simple testing using Java SE (Junit, Maven)
● Packaging/Bundling– Integration testing,
– Ship server with app
GlassFish Administration Concepts
● Domain – An administrative name space. Can administer multiple instances, on same or different node.
– Domain Administration Server (DAS) used to centrally administer domain
● Instance – Is a JVM process. Applications are deployed to instances.
● Virtual Hosting – Each instance can do virtual hosting
GlassFish Domains
● Multiple instances in a domain● Instance can belong to only one
administrative domains● One DAS per domain● Each domain has own isolated configuration● Standalone instances or clusters
– share applications and resources
● Each instance has own config for ports etc
GlassFish Administration Channels
● Web App: Admin Console – easy to use,● Command line: asadmin – bash scripting● JMX – Admin GlassFish from your code,● Restful API – REST client
GlassFish Administration
● Ease of administration - Can create – new domains,
– New instances,
– Deploy applications
● Across nodes using SSH (Unix/Linux( or DCOM(Windows)
GlassFish Clustering
● High Availability with clustering,● Session replication, ● Fail-over,● Application deployment support,
GlassFish Monitoring
● Monitoring via– Admin console
– Asadmin command line utility
– REST interface
– JMX
● Monitoring Server– Services – Off/Low/High
● JDBC connection● HTTP services etc
Multi-Language Support
● Support can be installed via update manager● PHP via
– jfastcgi
– php/java bridge
– Quercus – Java implementation of PHP
● Pyhton– Jython container can run Django apps
– fastcgi
Application Versioning
● Deploy multiple versions of an app, only one enabled
● Commands– asadmin deploy foo.war
– Asadmin deploy -name=foo:beta-1 foo.war
– Asadmin deploy -name-foo:beat-2 -enable false foo.war
– Asadmin enable foo:beta-2
Application Versioning
● asadmin deploy -name=foo:rc1 foo.war● asadmin undeploy foo:beat*● asadmin undeploy foo:*
Application Scoped Resource
● Created and Destroyed when application is deployed and undeployed
● Ensures no other application uses your resources which are usually globally defined
● Modules with deployment descriptor scoped to those modules only
Application Scoped Resource
● glassfish-resources.xml– JDBC connection pool,
– JDBC rsources
– Connector Connection pools
– Resource adapters
– External JNDI resources,
– JavaMail resources