Goal - deploy project war on Jboss EAP 6.4 with new values provided for context-param parameters in web.xml without editing existing war.
Current status -
My default web.xml -
<?xml version="1.0" encoding="utf-8"?><web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>Myproject Web Service</display-name>
<context-param>
<param-name>myproject.appserver</param-name>
<param-value>jbosseap</param-value>
</context-param>
<context-param>
<param-name>myproject.logpath</param-name>
<param-value></param-value>
</context-param>
<context-param>
<param-name>myproject.dbtype</param-name>
<param-value></param-value>
</context-param>
<listener>
<listener-class>com.myproject.ApplicationStartListener</listener-class>
</listener>
<error-page>
<error-code>404</error-code>
<location>/pages//404ErrorView.html</location>
</error-page></web-app>
Required values as -
<context-param>
<param-name>myproject.logpath</param-name>
<param-value>D:\myproject\vXX\workspace</param-value>
</context-param>
<context-param>
<param-name>myproject.dbtype</param-name>
<param-value>MSSQL</param-value>
</context-param>
Troubleshoot -
Since we are shipping same war to customers so it is decided not to let customers edit the war and deploy.
If overriding at deployment time isnt at all possible then any official doc reference for such limitation would be helpful. Thank you.
Jboss EAP does not support context-param replacement like tomcat. But it does support content replacement for deployed WAR.
Solution - Replace web.xml using deployment-overlay
command.
Official documentation
Hence at user end, web.xml template is required and user will have to put values for context-param as per their environment and re-deploy war.
war and web.xml must be inside \bin. Else deployment-overlay
command fails to recognize path.
Command sequence - Using jboss-cli.bat -
[standalone@localhost:9990 /] deploy s1temp/myproj.war
[standalone@localhost:9990 /] deployment-overlay add --name=s1overlay --content=WEB-INF/web.xml=s1temp/web.xml
[standalone@localhost:9990 /] deployment-overlay link --name=s1overlay --deployments=myproj.war --redeploy-affected