Mindmajix

Deploying Applications on JBoss AS 7

Deploying Applications on JBoss AS 7

Deployment is the process of uploading resources or applications into the application server. In the software production cycle, it’s the step that logically follows the development phase and can be performed either manually or in an automated fashion, using scripts.

In this tutorial, we will explore both approaches using the set of tools that are part of the server distribution. We will also cover how to deploy resources on the applications server using the Eclipse development environment, which is the preferred choice of JBoss AS developers.

In the last part of this chapter, we provide details about the new JBoss AS classloader architecture. In short, our agenda for this chapter includes the following topics:

  • Which resources can be deployed on the application server
  • How to deploy applications on JBoss AS standalone
  • How to deploy applications on JBoss AS domain
  • Understanding the JBoss AS 7 classloading architecture

Deploying resources on the application server

There are basically three file types that we work with in Java Enterprise applications:

  1. JAR file: This is the most basic package that can be used for both application and common resources.
  2. WAR file: This archive is used for packaging web applications.
  3. EAR file: This package acts as a container for Enterprise applications.

Besides these, JBoss AS is able to process the following archives, which provides additional functionalities to the application server:

RAR file: This is a resource adapter file, which is used to define a resource adapter component (the resource adapter subsystem is provided by IronJacamar project; for more information, look here: http://www.jboss.org/ironjacamar)

SAR file: This enables the deployment of Service Archives containing MBean Services, as supported by previous versions of the application server

In this chapter, we will discuss the first three kinds of archives, which constitute the typical packaging solution for Java Enterprise applications. Before discussing application deployment, let’s see the single archives a bit more in detail.

The JAR archive

A Java Archive (JAR) file is used for organizing many files into one. The actual internal physical layout is much like a ZIP file, and as a matter of fact, it uses the same algorithm as the zip utility for compressing files.

A JAR is generally used to distribute Java classes and associated metadata. In Java EE applications, the JAR file often contains utility code, shared libraries, and EJBs.

The WAR archive

A Web Application Archive (WAR) file is essentially an archive used to encapsulate a web application. The web application usually includes a collection of Java Server Pages (JSP), Servlets, Java classes, XHTML, and HTML files, plus other file types, depending on the technology used.

Since Java EE 6, a web application is now able to package EJBs in a WAR, using the same packaging guidelines that apply to web application classes. This means that you can place EJB classes under the WEB-INF/classes directory or as a JAR file within the WEB-INF/lib directory.

Because of this, it’s expected that developers will use the WAR archive as the most common type of archive to distribute Java EE 6 applications.

The EAR archive

An Enterprise Archive (EAR) file represents an application archive, which acts as a container for a set of modules. An EAR file can contain any the following:

  • One or more web modules packaged in WAR files
  • One or more EJB modules packaged in JAR files
  • One or more application client modules
  • Additional JAR files required by the application
  • JBoss specific archives such as Service Archives (.sar)

Note

The advantage of using an Enterprise Archive file is two-fold: at first, it helps to distribute all applications components using a single archive, instead of distributing every single module. Second, and most important, is the fact that applications within an EAR archive will be loaded by a single classloader. Thus, by default, each module will have visibility on other modules packed in the archive.

The isolation level of applications modules contained in the EAR archive is controlled by the ear-subdeployments-isolated element of the main configuration file (standalone.xml/domain.xml).

<subsystem xmlns=”urn:jboss:domain:ee:1.0″ >

<ear-subdeployments-isolated>false</ear-subdeployments-isolated>

</subsystem>

In the section of this tutorial named JBoss AS 7 classloading explained, we will discuss in depth the application server classloading architecture, also showing how to override this configuration setting at application level.


0 Responses on Deploying Applications on JBoss AS 7"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.
Course Adviser

Fill your details, course adviser will reach you.