WildFly users

For WildFly users you have to include in jboss-web.xml the Root Web context ("/") at first:

<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
      http://www.jboss.com/xml/ns/javaee
      http://www.jboss.org/j2ee/schema/jboss-web_5_1.xsd">
   <context-root>/</context-root>
</jboss-web>

Then in your undertow configuration specify which application is deployed on the Root context by setting the default-web-module attribute as in this example:

/subsystem=undertow/server=default-server/host=default-host:write-attribute(name=default-web-module, value=demoroot.war)

This will result in:

<host name="default-host" alias="localhost" default-web-module="demoroot.war">
    <location name="/" handler="welcome-content"/>
    <filter-ref name="server-header"/>
    <filter-ref name="x-powered-by-header"/>
</host>

You can also specify as default web module a Web application that is packaged as module in an EAR file:

<host name="default-host" alias="localhost" default-web-module="App.ear.demoroot.war">
    <location name="/" handler="welcome-content"/>
    <filter-ref name="server-header"/>
    <filter-ref name="x-powered-by-header"/>
</host>

JBoss AS 7

Follow these steps:

1) Disable the Welcome application by running the following command from JBoss CLI:

/subsystem=web/virtual-server=default-host:write-attribute(name=enable-welcome-root,value=false)

2) Configure your Web application to use the root context.
To configure your web application to use the root context (/) as its URL address, modify its jboss-web.xml, which is located in the META-INF/ or WEB-INF/ directory. Replace its <context-root> directive with one that looks like the following.

<jboss-web>
   <context-root>/</context-root>
</jboss-web>

Deploy your application to the server group or server you modified in the first step. The application is now available on http://SERVER_URL:PORT/.

JBoss AS 4-5-6

  • First you have to remove the default Web application that ships with JBoss (ROOT.war).

  • Then deploy your web application taking care to add in your application the file WEB-INF\jboss-web.xml

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

 

0
0
0
s2smodern

Related articles available on mastertheboss.com

How do I reload dynamically my jsp from an ear ?

  Deploy your Jsp as part of an application deployed in exploded

Where is my compiled JSP ?

JBoss recipe of the day

How do you configure WildFly / JBoss to enable HTTP logging ?

WildFly users WildFly uses Undertow as Web server, which has dep

JBoss Struts tutorial

This article explains how you can setup quickly an application ba

How to restrict access to JBoss web application by IP or Host?

You can create easily Access control list based on the IP address

Developing Portlets with JBoss Portal

JBoss Portal is an open source platform for hosting and serving a