Using Environment Variables in Standalone.xml in WildFly application

2,416 views
Skip to first unread message

Stan Smith

unread,
Oct 6, 2022, 10:46:03 AM10/6/22
to WildFly
Hello!

I am having trouble getting environment variables to resolve On a Linux VM when I start up a WildFly java application.

<system-properties>
        <property name="java.util.logging.manager" value="org.jboss.logmanager.LogManager"/>
        <property name="appname.url" value="https://${env.Environment}/appname"/>
</system-properties>

When I echo that environment variable (defined in /etc/environment) I get the following:
[ ~ ]$ echo $Environment
tst

Starting the application using it's service (i.e., systemctl restart appname) throws errors in the logs like this:
ESC[0mESC[31m09:11:37,203 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("system-property" => "appname.url")]) - failure description: "WFLYCTL0211: Cannot resolve expression 'https://${env.Environment}/appname'"

I've tried updating the standalone.xml to have this these two properties set to true:
<subsystem xmlns="urn:jboss:domain:ee:4.0">
            <spec-descriptor-property-replacement>true</spec-descriptor-property-replacement>
            <jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>

Also tried updating bin/jboss-cli.xml with this setting set to true:
<resolve-parameter-values>true</resolve-parameter-values>

Unfortunately, this does not resolve my issue. Any ideas?

Thanks!

Stan Smith

unread,
Oct 7, 2022, 12:11:01 PM10/7/22
to WildFly
Was able to sort this out! Answer is on stackoverflow - https://stackoverflow.com/a/73989867/2600073
Reply all
Reply to author
Forward
0 new messages