JBoss deployment

From Oxxus Wiki

Jump to: navigation, search

Unlike Tomcat, Apache servlet mounter which can serve java sourcs, Jboss is fully java J2EE server, with it's own deployers which will mount up and deploy any new web app placed into Jboss deploy folder, without need for Jboss server restart.

Jboss has to be restarted only in case if any of its configuration files are altered. For example, if virtual domain is added or start-up parameters are changed (heap size) etc. So if only new application is added, there is no need for restart. Just place it at Jboss deploy folder and Jboss will do the rest.

The EAR and WAR (application archives, Enterprise or Web-App) can be used for deploying new web applications. Below is a simple Hello World example. First is set as ROOT web application and second example shows it as a separate application.

Having your web application as ROOT, main web application

Before beginning with either of examples, we'll start with simple Hello World example java source.

HelloWorld.jsp:

<%@ page import="java.util.*" %>
<html>
     <head><title>Hello World</title></head>    
     <body>
          <%! String message = "Hello, World!"; %> 
          <h1><%= message%> </h1>
          Today's date: <%= new Date() %>
     </body>
</html>

There are two ways to have your Hello World example as main web content.

First one is to remove or rename ROOT.war which every Jboss initial installation has and place your archive as ROOT.war

Once it's placed into deploy folder, it'll be mounted up as main web contents.

Another, more elegant way, is to define your web application as it's for main web contents and remove ROOT.war.

Create file jboss-web.xml in WEB-INF/ with contents below:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
    <context-root />
</jboss-web>

Archive your Hello World into WAR or EAR and place it to Jboss deploy folder. Hello World page will appear when you access your domain instead of default Jboss welcome page.

The most common JBoss problems may assist if you're having difficulties.

Contact About Us Support Network Servers Java Hosting Oxxus.net Order Now! Dedicated Servers VPS Hosting Tomcat Hosting Java Hosting Money Back Guarantee Privacy Policy Oxxus.net Terms of 
Service Contact About Us Servers Networks Support Domain Names SSL Certificates Java Wiki Tutorials E-learning 
Platforms