Homepage of Ingo Klöckl
 Home
 Programmieren
 - Toolbox
 - Java
 - PostScript
 - Perl
 - Assembler
 - Links
 - Download
Ingo Klöckl
i.kloeckl@2k-software.de

Setting up directories for a web application in JBoss 3.0.4

Using unpacked directories

The J2EE specification dictates the structure of enterprise and web archive files, which are normally and reasonably used in production environment, offering simple handling and exchanging. But during the development cycle, it would be fine to just copy or modify your JSPs in the JBoss environment and seeing (almost) immediately the changes in effect. To do so (and making the development much more quick), you can use unpacked archives, using directories with the same structure as the archives have internally. This structure is explained in the following sections.

Using unpacked directories

The port where your web application will listen, is specified in the file tomcat41-service.xml in the deploy directory of JBoss. In the Server/Service node, there is an entry for a HTTP connection, which can be modified as follows for listening on port 8080:

<Connector className = "org.apache.catalina.connector.http.HttpConnector"
  port = "8080" minProcessors = "3" maxProcessors = "10" enableLookups = "true"
  acceptCount = "10" debug = "0" connectionTimeout = "60000"/>

Using just a web archive directory

The directory setup for this case, where you only want to have a (exploded or unpacked) web archive, is as follows:

$jboss_root/server/default/deploy
  ingo.war
    WEB-INF
      web.xml
      jboss-web.xml
  index.jsp
  your_other.jsp
The web.xml file can be as simple as this (naturally, it must be adopted to fit your needs and will typically bigger than this one):
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN'
    'http://java.sun.com/dtd/web-app_2_3.dtd'>

<web-app>
  <display-name>Test war file</display-name>
</web-app>
The jboss-web.xml declares the name of your web context and can be as simple as this one:
<?xml version="1.0"?>
<jboss-web>
	<context-root>/ingo</context-root>
</jboss-web>
With these settings, you can call your JSps with URLs like http://adrasteia:8080/ingo/your_other.jsp.

Using a full enterprise archive directory with web part

In this scenario, you want to keep the possibility to add an EJB layer later on. To supply this, we can also use a full (exploded or unpacked) enterprise archive structure, in which we mainly use the web part:

$jboss_root/server/default/deploy
  root.ear
    META-INF
      application.xml
    ingo.war
      WEB-INF
        web.xml
      index.jsp
      your_other.jsp
The file application.xml lists all modules belonging to your enterprise application. In the case just be discussed, this is only the web module, so this file can be as small as this one:
<?xml version="1.0"?>
<!DOCTYPE application 
  PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN"
  "http://java.sun.com/j2ee/dtds/application_1_2.dtd">

<application>
	<display-name>default application</display-name>
	<module>
		<web>
			<web-uri>ingo.war</web-uri>
			<context-root>/ingo</context-root>
		</web>
	</module>
</application>
This file also specifies the context name of the listed web module.
The file web.xml contains the usual web application settings, but may be as smart as this:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN'
    'http://java.sun.com/dtd/web-app_2_3.dtd'>

<web-app>
  <display-name>Test war file</display-name>
</web-app>
Note that there is no need for a jboss-web.xml file because the context path was already specified in application.xml. Again, with these settings, you can call your JSps with URLs like http>://adrasteia:8080/ingo/your_other.jsp.

back to JBoss page

back to toolbox page