Monday, April 23, 2018

Wildfly: deploy an application as a root context

Schemas for the standalone.xml can be found in D:\apps\wildfly12\docs\schema

For the undertow (former web) subsystem, use wildfly-undertow_5_0.xsd

and the virtual-server is defined in jboss-as-web_2_2.xsd (which is JBoss AS, not Wildfly)

This CLI:
/subsystem=undertow:write-attribute(name=default-virtual-host, value=default-host)
adds default-virtual-host="default-host" to the line subsystem xmlns="urn:jboss:domain:undertow:5.0" in config.xml

subsystem xmlns="urn:jboss:domain:undertow:5.0"

Very helpful:

By default, Wildfly 12 comes with this Undertow configuration

<subsystem xmlns="urn:jboss:domain:undertow:5.0">
 <buffer-cache name="default"/>
 <server name="default-server">
  <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
  <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
  <host name="default-host" alias="localhost">
   <location name="/" handler="welcome-content"/>
   <filter-ref name="server-header"/>
   <filter-ref name="x-powered-by-header"/>
   <http-invoker security-realm="ApplicationRealm"/>
 <servlet-container name="default">
  <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
  <response-header name="server-header" header-name="Server" header-value="WildFly/11"/>
  <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>

According to the book "WildFly Configuration, Deployment, and Administration - Second Edition" , page 118, if you want to deploy a webapp to handle the / root context, you first have to run this CLI:


After which the entry <location name="/" handler="welcome-content"/> will disappear from the standalone.xml

To build such CLI command, it's very useful to open the Administration console, then bottom right you have "Tools" "Management Model" , then you navigate in the tree matching the structure you can read in the XML.
Unfortunately CLI can't be generated directly from the console (as it was the case in WLST and WebLogic! One huge point in favor of WebLogic!)


git clone
cd primefaces-test
mvn clean package

(in the CLI) deploy c:\pierre\gitclones\primefaces-test\target\primefaces-test-1.0-SNAPSHOT.war

enter localhost:8080 and your webapp is there instead of the ROOT.war application !

Enter http://localhost:9990/console/App.html#standalone-deployments;backButton=/deployments-details and you see the

No comments: