Defining a JavaEE DataSource in your WAR file

You may also like...

3 Responses

  1. Marcio Barroso says:

    Thanks ! Very helpfull

  2. sandev says:

    hi how can make the data source password dynamic so it can be calculated for each client

    • Dan says:

      You’ll need to modify your Wildfly configuration file (e.g. standalone.xml) and go to the subsystem labeled “urn:jboss:domain:ee:4.0” (the version number at the end can be different). There should already be a “spec-descriptor-property-replacement” defined in that subsystem. You’ll need to add the following line to it:

      Now, in your -ds.xml file you can add properties in place of static text. Example:


      When you launch Wildfly you will need to define the new property like this:

      standalone.bat -DUSERNAME=exampleuser

      Unfortunately, I couldn’t figure out how to directly pass environment variables into the ds.xml file. You could just pass them on the command-line above to accomplish the same thing although it isn’t ideal (e.g. -DUSERNAME=%USERNAME%)

      Hope this helps!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.