What is EAR File?
EAR (Enterprise Application Archive) is a file format used by Java EE for packaging one or more modules into a single archive so that the deployment of the various modules onto an application server happens simultaneously and coherently.
It also contains XML files called deployment descriptors which describe how to deploy the modules.
What is WAR File?
A WAR file is, Compressed package containing Java-based Web components and applications that are run on a Web server; formatted the same way as a .JAR file,
but includes additional information that tells the application server which Java servlet class to run.
Deploying EAR and WAR Files on CENTOS/RHEL
Deploying an application with JBoss AS is a straightforward task. If you have access to the host where JBoss is installed you can simply copy the application (.jar , .war, .ear etc) into the JBOSS_HOME/server/<your config>/deploy folder.
Simply substitute <your config> with your server configuration (default, all, minimal, web, standard)
An application can be deployed in two flavours:
- Packed archive (.jar , .war, .ear)
- Exploded directory (directory whose name ends with .jar, .war, .ear)
It is advised to use exploded directory for development and packed archive for production since you can do partial redeployments of the application with exploded directory.
For example if you are deploying a Web application and you want to update just one Servlet, with exploded directory you can do it without redeploying the application.
Also remember that simply “touching” a Java EE configuration file (web.xml , application.xml) causes the application to redeploy. In the same way, touching a JBoss specific configuration file (like jboss-web.xml) will cause the application to redeploy as well.
discoverycommand. This runs a discovery scan.
Search for the JBoss server instance to which to deploy the EAR or WAR.
On the details page for the selected JBoss server instance, open the Inventory tab.
In the Create New menu at the bottom, select the item for or , as appropriate.
Enter the version number.This is not used for the resource. The actual version number is calculated based on the spec version and implementation version in
MANIFEST.MF, if any are given, or the calculated SHA-256 value for the package itself:
SPEC(IMPLEMENTATION)[sha256=abcd1234]If no version numbers are defined in
MANIFEST.MF, then the SHA value is used. The SHA value is always used to identify the package version internally.
NOTEWhen the EAR or WAR file is exploded after it is deployed, the
MANIFEST.MFfile is updated to include the calculated SHA version number. For example:
Manifest-Version: 1.0 Created-By: Apache Maven
RHQ-Sha256: 570f196c4a1025a717269d16d11d6f37...For more information on package versioning, see “Deploying Applications and Content”.
Upload the EAR/WAR file.
Enter the information for the application to be deployed.
Whether the file should be exploded (unzipped) when it is deployed.
The path to the directory to which to deploy the EAR or WAR package. The destination directory is relative to the JBoss server instance installation directory; this cannot contain an absolute path or go up a parent directory.
Whether to back up any existing file with the same name in the target directory.
Deploying applications on JBoss AS 7
Applications are deployed differentely depending on the type of server. If you are deploying to a domain of servers then you need the Command Line Interface because the application server needs to be informed on which server group/s the deployment is targeted.
Ex. Deploy an application on all server groups:
deploy MyApp.war --all-server-groups
Ex. Deploy an application on one or more server groups (separated by a comma):
deploy application.ear --server-groups=main-server-group
If you are deploying to a standalone server then you can either use the CLI or drop the deployment unit into the server deployments folder.
The deployments folder is the location in which users can place their deployment content (for example, WAR, EAR, JAR, SAR fi les) to have it automatically deployed into the server runtime. Users, particularly those running production systems, are encouraged to use the JBoss AS management APIs to upload and deploy deployment content instead of relying on the deployment scanner subsystem that periodically
scans this directory
As soon as the deployer HD scanner detects the application, the module is moved to the work folder of the application, leaving a placeholder Test.war.deployed file in the deployments folder.
Note: With the default configuration, packaged archives (.ear, .war, .jar, .sar) are automatically deployed. Exploded archives need adding a .dodeploy empty file in the deployments folder to trigger deployment.
JBoss Web Web Application Deployment
Deploy EAR and WAR File on RHEL JBOSS
Deploy Application on Jboss AS 7
Basic concepts of web applications, how they work and the HTTP protocol
Web Server VS Web Container vs Application Server
How to Deploy your application On JBoss