7/14/2008 ============================ Intro to Application Servers ============================ - What is JEE? . JEE is a specification . Sun - "coordinated technologies that significatnly reduces the cost and complexity of developing, deploying and managing multi-tier server-centric applications" - What are JEE Application Servers ? . Provide a container / platform for running applications that implement the JEE Spec . Most provide multi-threading, high availability through clustering, load balancing . Provides a central location for managing resources (Databases, Application Instances) . Often provides JEE Services . Servlet . Java Server Pages . EJB . JMS . JPA . JTA . JDBC Connection Pooling . JNDI - What are the different types of Application Servers? . Those that fully implement the JEE Spec and those that don't . Servlet (Web) Containers - provide limited implementation of the JEE Spec . Servlet . JSP . JNDI . JDBC Connection Pooling - host web applications (war) . JEE Application Containers - provide the full implementation of the JEE Spec . EJB . JMS - host Enterprise Applications (ear) - Why would you want to use one? . multi-threading . high availability - clustering / load balancing . Deploy Java Applications onto the Web . If you want to build Web Services - What are the most widely used application servers? . Open Source (free to download and use in production environment) - Jetty "Mortbay" (Servlet Container) - Tomcat "Apache" (Servlet Container) - GlassFish "Sun" (JEE Container) - Geronimo "Apache" (JEE Container) . Commercial (must pay for licenses to use in production environment) - BEA Weblogic - purchased by Oracle - Websphere - IBM - How do you install and configure one? - How do you deploy applications to an Application Server? ========= GlassFish ========= * RefCardz now available for GlassFish c/o DZone * Great. No problem getting things up and running, very smooth experience - Install . download the *.jar file . java -Xmx256m -jar 'filename' - accept the license agreement - will unbundle glassfish into 'glassfish' dir . cd 'glassfish' . lib/ant/bin/ant -f setup.xml - will create default domain * domain - "provides authentication and administration for the server instance that belongs to it" - Starting Domain . ./asadmin.bat start-domain domain1 . launch a browser and connect using http://localhost:4848 . login as admin/adminadmin - Deploying Applications . AutoDeploy - copy the artifact to the $GLASSFISH_HOME/domains/domain1/autodeploy - access application at http://localhost:8080/hello - Stopping Domain . ./asadmin.bat stop-domain domain1 ===== JBoss ===== * Noisy output. Can distract from what is really happening * Ugly Administration Console - Install . download the zip file . extract it to some directory * Different configurations . minimal - provides bare minimum services including logging, jndi, url deployment scanner . default - base JEE 1.4 server . all - all services * To start server with alternate configuration './run.bat -c minimal' - Starting JBoss . $JBOSS_HOME/bin/run.bat - Deploying Applications . move the applications to the deploy directory under the configuration that is currently running - Undeploy Applications . delete it from the deploy directory - Stopping the Server . Ctrl+C ===== Jetty ===== * Light Weight, and very fast Web Container * No administration console * OPINION - most widely used container out there. - Install . download and extract the file contents to some directory - Starting Jetty . java -jar start.jar ./etc/jetty.xml - starts jetty with an example web application . will start the server with the contexts described in $JETTY_HOME/contexts . also browses $JETTY_HOME/webapps for applications on startup * does not support hot deploy from the webapps directory - Deploying applications . if you want hot deploy, then you have to configure an xml file in the $JETTY_HOME/contexts . if you are fine with shutdown and startup - then you can put new versions of *.war files into webapp directory - Undeploy Applications - delete it - Stopping the Server - CTRL+C