17

servicelogI am newbie for Wildfly till now I was working on tomcat to deploy my applications. Now just for add on features of Wildfly we want to move on to this. I am using Windows Os, I have done with the basic implementation of wildfly to start service etc. but Unable to deploy the ROOT.war in place of Welcome page. I have studied and gone through lot of links, I added jboss-web.xml in my project WEB-INF folder with following settings as I got in links. But I am still unable to deploy the ROOT.war in standalone deployment. Each times it goes to failed. Not getting what I have done Wrong.

<?xml version="1.0" encoding="UTF-8"?>
<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>`

I have made the admin user, But for deploying I am using wildfly user setting only. For it also I uncommented the fields from bin/init.d wildfly.conf fly. But totally unaware of the error.

Note: We also tried it on linux machine but ROOT.war is not getting deployed there too.used

Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
Vartika
  • 1,085
  • 3
  • 17
  • 43
  • please paste server.log of the deployment – Tomaz Cerar Aug 27 '15 at 10:27
  • Sir, I goin through a e-book there i got some more bat files to be executed. It would be a grd help if you can help me with this as you have worked a lot on jboss. Any mail id sir – Vartika Aug 27 '15 at 10:40

6 Answers6

24

To override the welcome webapp with Wildfly, you need to create a jboss-web.xml in the WEB-INF of your webapp with this content:

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

But if you try to access to the root directory (e.g. http://localhost:8080/) you will still have the default welcome content. To remove it, you just need to rename the directory welcome-content in the Wildfly directory.

stefv
  • 429
  • 1
  • 4
  • 19
19

Two files have to be added in WEB-INF folder before creating a war file

  1. jboss-web.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <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>
    
  2. empty bean.xml

Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
Vartika
  • 1,085
  • 3
  • 17
  • 43
9

This is a solution for those using Maven in their projects. To make Wildfly host your application under /, you have to name the war file containing the application as "ROOT.war". To automate this action, change the default war file name in your pom.xml to ROOT like this:

...
</dependencies>
<build>
    <!-- <finalName>${project.artifactId}</finalName> -->
    <finalName>ROOT</finalName>

This way, when deploying the application to Wildfly using Maven, the file is automatically hosted in the root.

2

If your web module is inside an ear you can you the following syntax

<host name="default-host" alias="localhost" default-web-module="myApp.ear.myWebApp.war">
user1593165
  • 503
  • 3
  • 6
1

The welcome page has a note at the bottom,

To replace this page set "enable-welcome-root" to false in your server configuration and deploy your own war with / as its context path.

Please confirm if you did set the enable-welcome-root to false.

Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
Phuthib
  • 1,326
  • 2
  • 13
  • 20
  • 1
    Sir, I am using 9.0.1 ver that don't have this property and I read somewhere that no need to do so just add jboss-web.xml in your application with context path"/". – Vartika Aug 28 '15 at 05:09
1

For my wildfly 9.0.1 deployment, we did the following two and it worked.

  1. jboss-web.xml as described above by other experts.

  2. In standalone.xml,

    <host name="default-host" alias="localhost, myAppDomain.com" default-web-module="myApp.war">
        <location name="/" handler="welcome-content"/>
        <filter-ref name="server-header"/>
        <filter-ref name="x-powered-by-header"/>
    </host>
    
Young
  • 99
  • 1
  • 1
  • 4