We are developing an application that is deployed in a JBoss. we would like to define a properties files like this:
URL_DEVELOPMENT.properties = ...
URL_TEST.properties = ...
URL_PRODUCTION.properties = ...
and define an environment variable in the JBoss which contains the information about the execution context
for example --> ENVIRONMENT = DEVELOPMENT
Anyone knows:
How to set environment variables in JBoss.
How to get these variables from an applicacion deployed in JBoss in runtime execution?
Setting the JBOSS_HOME variable in Linux. Before you can run the JBoss Application Server, you need to ensure that you've configured the JBOSS_HOME environment variable in your . bashrc file as follows. In this example the Application Server folder has beeen copied to the /usr/jboss/jboss-<release> folder.
6.2. Setting the JBOSS_HOME variable in Windows. Create an environment variable called JBOSS_HOME that points to the JBoss Application Server installation directory, for example: C:\Program Files\JBoss\jboss-<release>\ .
At the command line, echo $JBOSS_HOME to see if it is currently defined in your environment: The RestcommONE Platform and most RestcommONE servers are built on top of the JBoss Application Server (JBoss AS).
The RestcommONE Platform (RestcommONE) is built on top of the JBoss Application Server (JBoss AS). You do not need to set the JBOSS_HOME environment variable to run any of the RestcommONE Platform servers unless JBOSS_HOME is already set.
To set environment variables on Microsoft windows: From the Windows Start Menu, select Settings, select Control Panel, select System, select Advanced, then select Environment Variables. In the System Variables list, select Path, then click Edit. In the Variable Value field, add the location of the JDK to the beginning of the existing path.
The easiest and most straight forward way is to log into jboss web admin: www.yoururl:9990
Then under configuration, look for system property.
At runtime, it is very easy: System.getProperty(yourPropertyKey)
and the good thing is that a change in any of these properties is reflected immediately at runtime.
The other scenario is to open up standalone.xml
<server ...>
<system-properties>
<property name="eclipselink.archive.factory" value="org.jipijapa.eclipselink.JBossArchiveFactoryImpl"/>
</system-properties>
</server>
The other option is to read on jboss cli and configure system properties from there. (Only useful if you want to work with remote jboss and you cannot ssh into the server, and you cannot access the web admin)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With