SlideShare a Scribd company logo
JBOSS Application ServerBy Dilek Karadaş09/05/2010
PLANApplication server definitionApplication server architectureJava application serversAdvantages of application serversJboss application serverJboss installationJboss managementJboss shut downDeploymentRun applicationModify deployed applicationUndeploy
Application Server “Definition”An application server is a server program in a computer in a distributednetwork that provides the business logic for an application program.In a two-tier client/server environment, which is most common, the user's machine performs the business logic as well as the user interface, and the server provides the databaseprocessing.In a three-tier client/server environment, an application server provides middle tier processing between the user's machine and the database management system (DBMS).
Application Server “Architecture”
Java Application ServersSome of the better-known Java Enterprise Edition application servers include:Apache Geronimo (Apache Software Foundation)Apache Tomcat (Apache Software Foundation)Glassfish Application Server (Oracle Corporation)WebSphere Application Server and WebSphere Application Server Community Edition (IBM)JBoss (Red Hat)Jetty (Eclipse Foundation)JRun (Adobe Systems)Oracle OC4J (Oracle)WebLogic Server (Oracle)SAP Netweaver AS (ABAP/Java) (SAP)tc Server (SpringSource)Sun GlassFish Enterprise Server (based on GlassFish Application Server) (Oracle Corporation)Sybase Enterprise Application Server (Sybase Inc)Tcat Server (MuleSoft)WebObjects (Apple Inc.)JEUS (Tmaxsoft Inc.)
Advantages of Application ServersDataand codeintegrity:  no risk of old versions of the application accessing or manipulating data in an older, incompatible manner. Centralized configuration:  changes to the application configuration, such as a move of database server, or system settings, can take place centrally.Security: acentral point through which service-providers can manage access to data and portions of the application itself counts as a security benefit, devolving responsibility for authentication away from the potentially insecure client layer without exposing the database layer.Total Cost of Ownership (TCO):  in combination, the benefits above may result in cost savings to an organization developing enterprise applications.Transaction Support:atransaction represents a unit of activity in which many updates to resources (on the same or distributed data sources) can be made atomic (as an indivisible unit of work). End-users can benefit from a system-wide standard behavior, from reduced time to develop, and from reduced costs. As the server does a lot of the tedious code-generation, developers can focus on business logic.
JBoss Application ServerJBoss Application Server is the #1 most widely used Java application server on the market.Because it is Java-based, the JBoss application server operates cross-platform: usable on any operating system that supports Java. JBoss AS was developed by JBoss, now a division of Red Hat.
Jboss Application Server InstallationFirst install Java 1.4 or Java 1.5 on your machine.Get Jboss from Jboss download page http://www.jboss.org/downloads/indexDownload archive file of Jboss for the version that you want to install.Extract Jboss archive to the location that you want to install your Jboss application server.You are now ready to start your jboss server by running run.bat file in the bindirectory of the jboss server.Port 8080 should be available on your machine, otherwise you need to change port configuration of the server.After start up finishes visit http://localhost:8080/ to be sure that your server is up and running.
Jboss Application Server ManagementJMX Console:JBoss application server provides a management application that lets you see and manage the services that are deployed and running inside the server.Console location:http://localhost:8080/jmx-consoleWhen you are there, you will see that page:
Jboss Application Server Shutting DownThree possible ways to shut down the server: Use the JMX Console to go to the jboss.system domain and choose the type=Server MBean link. On the MBean page, scroll down to the operations section and click the "Invoke" button for the shutdown( ) operation.Run the shutdown script for your platform in the same directory where you found the run script.Type Ctrl-c in the same console window where you started JBoss.When JBoss is stopped, you'll see the following message:03:50:02,412 INFO [Server] Shutdown complete
Jboss Application Server ConfigurationJBoss provides several different configurations that range from a barebones server with no J2EE capabilities to a superserver with more services than any single application could possibly use.Minimal: This configuration provides the bare services you might need in the simplest application: logging, JNDI naming services, and URL deployment scanning. This configuration doesn't provide support for EJBs, web applications, JMS, or any other high-level services.Default:  This is a lightweight J2EE configuration; it's the one most people use. It provides most of the common J2EE services, but it doesn't include IIOP, JAXR, or clustering services, for example. These services can be added easily to this configuration.All: This configuration includes everything in JBoss. If you need any extra services not provided in the default configuration, this is the place to start. It's often easier to start from the all configuration and take out unwanted services than to start with the default configuration and add the desired services.You specify a particular configuration using the -c command to the run script. To run the minimal configuration, for example, use -c minimal.
Jboss Application Server DeploymentAnt:  Ant is a build tool made with Java in mind, allowing Java developers to have a tool that fits with the Java environment and mentality. It is an expandable, open source tool that is constantly being upgraded and extended to support the latest Java standards.Go to page http://ant.apache.org/bindownload.cgi and download  a binary distribution of Ant.Unpack the distribution to your local machine.Set the ANT_HOME environment variable to point at the directory in which you unpacked Ant.You can do a quick check to see if Ant is working by typing ant–versionon the command line. You should see something like this:ant -version Apache Ant version 1.6.2 compiled on July 16 2004
Jboss Application Server DeploymentCreate and package the application:Package= WAR file WAR file structure:
Jboss Application Server DeploymentSome important files for WAR:Web.xml: describes the web application and how the web container will deploy the application.	Example:<?xml version="1.0" ?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <servlet> <servlet-name>QuoteServlet</servlet-name><jsp-file>/quote.jsp</jsp-file></servlet> <servlet-mapping><servlet-name>QuoteServlet</servlet-name><url-pattern>/quote</url-pattern> </servlet-mapping></web-app>
Jboss Application Server Deploymentbuild.xml: pulls together all the stuff for our application, and makes the WAR file. It also has tasks for deploying, undeploying and cleaning.Example: <?xml version="1.0"?> <project name="Hello World Buildfile" default="main" basedir="."> <property name="top.dir" value="."/><property name="src.dir" value="${top.dir}/src"/><property name="lib.dir" value="${top.dir}/src/lib"/> <property name="jboss.dir" value="/users/samjr/jboss-4.0.2"/> <property name="jboss.deploy.dir“ value="${jboss.dir}/server/default/deploy"/><target name="clean"> <echo message="In clean"/><delete file="${top.dir}/quote.war"/></target> <target name="main"><echo message="In main"/> <war warfile="quote.war" webxml="${src.dir}/metadata/web.xml"> <fileset dir="${src.dir}/appfiles"/> <lib dir="${lib.dir}"/> </war> <antcall target="deploy"/> </target> <target name="deploy"> <echo message="In deploy"/> <copy file="${top.dir}/quote.war" todir="${jboss.deploy.dir}"/> </target> <target name="undeploy"> <echo message="In undeploy"/> <delete> <fileset id="quote_wars" dir="${jboss.deploy.dir}" includes="*quote*.war"/> </delete> </target> </project>
Jboss Application Server Running the ApplicationAccess to the application through Url:The path to use in the URL is based on the WAR file's name and the url-pattern from the servlet-mapping section in the web.xmlfile.http://hostName:port/application WarName/ServletNameWhen you went to the URL for the application, the application compiled and created a servlet based on what is specified in the servlet section of the web.xml file. Then JBoss deployed that servlet and created a mapping based on the servlet-mapping section of the web.xmlfile. Again, the URL is based on the WAR filename created by the build (look in build.xml) and the URL pattern mapping in the web.xml file.
Jboss Application Server Modifying deployed applicationYou are able to modify jsp’s and static contents withhout the need for redeployment. You are not able modify deployment descriptor files without the need for redeployment.
Jboss Application ServerUndeploymentTwo ways to do that:Delete war file under deploy directory of Jboss server.Run undeploy ant target of the build.xml file.
Thanks..Questions??For further reading on advanced topics,you can refer toJBoss: A Developer'sNotebookBy Sam Griffith, Norman RichardsO'Reilly

More Related Content

Jboss App Server

  • 1. JBOSS Application ServerBy Dilek Karadaş09/05/2010
  • 2. PLANApplication server definitionApplication server architectureJava application serversAdvantages of application serversJboss application serverJboss installationJboss managementJboss shut downDeploymentRun applicationModify deployed applicationUndeploy
  • 3. Application Server “Definition”An application server is a server program in a computer in a distributednetwork that provides the business logic for an application program.In a two-tier client/server environment, which is most common, the user's machine performs the business logic as well as the user interface, and the server provides the databaseprocessing.In a three-tier client/server environment, an application server provides middle tier processing between the user's machine and the database management system (DBMS).
  • 5. Java Application ServersSome of the better-known Java Enterprise Edition application servers include:Apache Geronimo (Apache Software Foundation)Apache Tomcat (Apache Software Foundation)Glassfish Application Server (Oracle Corporation)WebSphere Application Server and WebSphere Application Server Community Edition (IBM)JBoss (Red Hat)Jetty (Eclipse Foundation)JRun (Adobe Systems)Oracle OC4J (Oracle)WebLogic Server (Oracle)SAP Netweaver AS (ABAP/Java) (SAP)tc Server (SpringSource)Sun GlassFish Enterprise Server (based on GlassFish Application Server) (Oracle Corporation)Sybase Enterprise Application Server (Sybase Inc)Tcat Server (MuleSoft)WebObjects (Apple Inc.)JEUS (Tmaxsoft Inc.)
  • 6. Advantages of Application ServersDataand codeintegrity: no risk of old versions of the application accessing or manipulating data in an older, incompatible manner. Centralized configuration: changes to the application configuration, such as a move of database server, or system settings, can take place centrally.Security: acentral point through which service-providers can manage access to data and portions of the application itself counts as a security benefit, devolving responsibility for authentication away from the potentially insecure client layer without exposing the database layer.Total Cost of Ownership (TCO): in combination, the benefits above may result in cost savings to an organization developing enterprise applications.Transaction Support:atransaction represents a unit of activity in which many updates to resources (on the same or distributed data sources) can be made atomic (as an indivisible unit of work). End-users can benefit from a system-wide standard behavior, from reduced time to develop, and from reduced costs. As the server does a lot of the tedious code-generation, developers can focus on business logic.
  • 7. JBoss Application ServerJBoss Application Server is the #1 most widely used Java application server on the market.Because it is Java-based, the JBoss application server operates cross-platform: usable on any operating system that supports Java. JBoss AS was developed by JBoss, now a division of Red Hat.
  • 8. Jboss Application Server InstallationFirst install Java 1.4 or Java 1.5 on your machine.Get Jboss from Jboss download page http://www.jboss.org/downloads/indexDownload archive file of Jboss for the version that you want to install.Extract Jboss archive to the location that you want to install your Jboss application server.You are now ready to start your jboss server by running run.bat file in the bindirectory of the jboss server.Port 8080 should be available on your machine, otherwise you need to change port configuration of the server.After start up finishes visit http://localhost:8080/ to be sure that your server is up and running.
  • 9. Jboss Application Server ManagementJMX Console:JBoss application server provides a management application that lets you see and manage the services that are deployed and running inside the server.Console location:http://localhost:8080/jmx-consoleWhen you are there, you will see that page:
  • 10. Jboss Application Server Shutting DownThree possible ways to shut down the server: Use the JMX Console to go to the jboss.system domain and choose the type=Server MBean link. On the MBean page, scroll down to the operations section and click the "Invoke" button for the shutdown( ) operation.Run the shutdown script for your platform in the same directory where you found the run script.Type Ctrl-c in the same console window where you started JBoss.When JBoss is stopped, you'll see the following message:03:50:02,412 INFO [Server] Shutdown complete
  • 11. Jboss Application Server ConfigurationJBoss provides several different configurations that range from a barebones server with no J2EE capabilities to a superserver with more services than any single application could possibly use.Minimal: This configuration provides the bare services you might need in the simplest application: logging, JNDI naming services, and URL deployment scanning. This configuration doesn't provide support for EJBs, web applications, JMS, or any other high-level services.Default: This is a lightweight J2EE configuration; it's the one most people use. It provides most of the common J2EE services, but it doesn't include IIOP, JAXR, or clustering services, for example. These services can be added easily to this configuration.All: This configuration includes everything in JBoss. If you need any extra services not provided in the default configuration, this is the place to start. It's often easier to start from the all configuration and take out unwanted services than to start with the default configuration and add the desired services.You specify a particular configuration using the -c command to the run script. To run the minimal configuration, for example, use -c minimal.
  • 12. Jboss Application Server DeploymentAnt: Ant is a build tool made with Java in mind, allowing Java developers to have a tool that fits with the Java environment and mentality. It is an expandable, open source tool that is constantly being upgraded and extended to support the latest Java standards.Go to page http://ant.apache.org/bindownload.cgi and download a binary distribution of Ant.Unpack the distribution to your local machine.Set the ANT_HOME environment variable to point at the directory in which you unpacked Ant.You can do a quick check to see if Ant is working by typing ant–versionon the command line. You should see something like this:ant -version Apache Ant version 1.6.2 compiled on July 16 2004
  • 13. Jboss Application Server DeploymentCreate and package the application:Package= WAR file WAR file structure:
  • 14. Jboss Application Server DeploymentSome important files for WAR:Web.xml: describes the web application and how the web container will deploy the application. Example:<?xml version="1.0" ?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <servlet> <servlet-name>QuoteServlet</servlet-name><jsp-file>/quote.jsp</jsp-file></servlet> <servlet-mapping><servlet-name>QuoteServlet</servlet-name><url-pattern>/quote</url-pattern> </servlet-mapping></web-app>
  • 15. Jboss Application Server Deploymentbuild.xml: pulls together all the stuff for our application, and makes the WAR file. It also has tasks for deploying, undeploying and cleaning.Example: <?xml version="1.0"?> <project name="Hello World Buildfile" default="main" basedir="."> <property name="top.dir" value="."/><property name="src.dir" value="${top.dir}/src"/><property name="lib.dir" value="${top.dir}/src/lib"/> <property name="jboss.dir" value="/users/samjr/jboss-4.0.2"/> <property name="jboss.deploy.dir“ value="${jboss.dir}/server/default/deploy"/><target name="clean"> <echo message="In clean"/><delete file="${top.dir}/quote.war"/></target> <target name="main"><echo message="In main"/> <war warfile="quote.war" webxml="${src.dir}/metadata/web.xml"> <fileset dir="${src.dir}/appfiles"/> <lib dir="${lib.dir}"/> </war> <antcall target="deploy"/> </target> <target name="deploy"> <echo message="In deploy"/> <copy file="${top.dir}/quote.war" todir="${jboss.deploy.dir}"/> </target> <target name="undeploy"> <echo message="In undeploy"/> <delete> <fileset id="quote_wars" dir="${jboss.deploy.dir}" includes="*quote*.war"/> </delete> </target> </project>
  • 16. Jboss Application Server Running the ApplicationAccess to the application through Url:The path to use in the URL is based on the WAR file's name and the url-pattern from the servlet-mapping section in the web.xmlfile.http://hostName:port/application WarName/ServletNameWhen you went to the URL for the application, the application compiled and created a servlet based on what is specified in the servlet section of the web.xml file. Then JBoss deployed that servlet and created a mapping based on the servlet-mapping section of the web.xmlfile. Again, the URL is based on the WAR filename created by the build (look in build.xml) and the URL pattern mapping in the web.xml file.
  • 17. Jboss Application Server Modifying deployed applicationYou are able to modify jsp’s and static contents withhout the need for redeployment. You are not able modify deployment descriptor files without the need for redeployment.
  • 18. Jboss Application ServerUndeploymentTwo ways to do that:Delete war file under deploy directory of Jboss server.Run undeploy ant target of the build.xml file.
  • 19. Thanks..Questions??For further reading on advanced topics,you can refer toJBoss: A Developer'sNotebookBy Sam Griffith, Norman RichardsO'Reilly