User Tools

Site Tools


How to create a directory to serve only static content in Jboss

For Jboss 7

Under Jboss 7, things have changed in this issue: Jboss AS 7 enforces the deployment with archive files (.war, .ear and so on) instead of cut-and-paste of the filesystem in the deployment directory.

For achieveing the same goal, the only thing you have to do is:

1. let's suppose you have a directory called “myApp” with three webpages: index.html, first.html and second.html:

  +--- index.html
  +--- first.html
  +--- second.html

2. you have to select the three elements and select “save as a zip file”: then the three files will be saved in a zip file called something like “”. 3. rename the file to “myApp.war” (to do this you probably have to set the extensions of your windows as “visible”). 4. and that's it, you have a war file ready to deploy into your jboss.

Yes, but I want also to deploy this application as the default application of the server

You only have to include a jboss-web.xml file with this content:


It is probable that many applications would fight for the root position of your web server and this will result in crashes, be careful with this.

For Jboss 5 and previous releases

Let's say that you want to create a url like http://localhost:8080/doc to serve only static content. How it is done???

Here are instructions:

  • Create a directory JBOSS_HOME/server/xxx/deploy/doc.war. The “.war” is very important.
  • Under this directory, create a directory WEB-INF and inside this directory a file called web.xml
  • The content of the file web.xml will be:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
 xmlns:xsi="" xsi:schemaLocation="">
java/staticminisiteinjboss.txt · Last modified: 2014/12/24 10:42 (external edit)