How to enable property substitution in deployment descriptors in EAP 6/7/8?
Issue
- How to enable property substitution (property replacement) in deployment descriptor in EAP 6 or 7?
- Can property substitution be used in
ejb-jar.xml
, for example:
<enterprise-beans>
<message-driven>
<ejb-name>...</ejb-name>
<ejb-class>...</ejb-class>
<activation-config>
...(snip)...
<activation-config-property>
<activation-config-property-name>maxSession</activation-config-property-name>
<activation-config-property-value>${my.prop.config}</activation-config-property-value>
</activation-config-property>
...(snip)...
</activation-config>
</message-driven>
</enterprise-beans>
and then pass system properties at start-up via command line (e.g, -Dmy.prop.config=20
) or via a properties file (e.g. -P myprops.properties
) which contains name=value
pairs.
- In web.xml files, system-properties could be defined using ${} form (such as ${property}, set using -Dproperty=xyz and also could be set in the JBoss profile, but the value is not being expanded in the web.xml
<system-properties>
<property name="property" value="test"/>
</system-properties>
- Is it possible to change the context-root at deploy-time for a web-application in a given EAR file that includes an application.xml file, without changing the EAR file?
- We are porting application from EAP 5.1.2 to EAP 6.2.0 in testing, observe
org.apache.naming.resources.FileDirContext.setDocBase()
does not support property substitution in EAP 6. Got the following error:
JBWEB000235: Allocate exception for servlet webdav: java.lang.IllegalArgumentException: JBWEB006706: Document base /opt/testapp/userAA/bin/${userAA.testapp.directory} does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:147)
- How to use dynamic values in the
web.xml
file ? - How to refer environment variables and/or system properties in web.xml
JAVA_OPTS
defined variablefoo=/somedir
. Folder${foo}/bar
exists and got read-write permission for the application. In 6.4, thewar
file deployed fine. In EAP 7.2,war
file deployed failed with error${foo}/bar does not refer to a valid directory
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 8.x
- 7.x
- 6.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.