Rakesh
Rakesh

Reputation: 177

Wildfly 8.0 Passing parameters to standalone.xml file

We are using wildfly 8.0 version for our legacy application. We are trying to pass datasource value as parameter in standalone.xml file but wildfly is throwing error as it's not recognizing $ sign.

standalone.xml

${DB_URL}

can anyone explain how to pass parameters in wildfly 8.0 server. We are starting our server as service.

service wildfly start

Here is snippet of standalone.xml

<profile>
 <subsystem xmlns="urn:jboss:domain:logging:2.0">
  <subsystem xmlns="urn:jboss:domain:datasources:2.0">
            <datasource jta="false" jndi-name="java:jboss/postgresDSPC" pool-name="postgresDSPC" enabled="true" use-java-context="true" use-ccm="false">
                    <connection-url>${DB_URL}</connection-url>
                    <driver>postgresql</driver>
                    <pool>
                        <min-pool-size>2</min-pool-size>
                        <max-pool-size>20</max-pool-size>
                    </pool>
                    <security>
                        <user-name>username</user-name>
                        <password>password</password>
                    </security>
                    <statement>
                        <prepared-statement-cache-size>50</prepared-statement-cache-size>
                        <share-prepared-statements>false</share-prepared-statements>
                    </statement>
              </datasource>
   </subsystem>
  <subsystem xmlns="urn:jboss:domain:weld:2.0"/>
</profile>             

Here is the value I see when I read using jboss-cli

  "connection-url" => {
                "type" => STRING,
                "description" => "The JDBC driver connection URL",
                "expressions-allowed" => true,
                "nillable" => false,
                "min-length" => 1L,
                "max-length" => 2147483647L,
                "access-type" => "read-write",
                "storage" => "configuration",
                "restart-required" => "no-services"
            },

Thanks Rakesh

Upvotes: 0

Views: 1765

Answers (1)

Laertes
Laertes

Reputation: 374

For environmental variables you will have to use the env. prefix. e.g.

${env.DB_URL} 

Upvotes: 2

Related Questions