Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set environment variables in JBoss

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:

  1. How to set environment variables in JBoss.

  2. How to get these variables from an applicacion deployed in JBoss in runtime execution?

like image 413
Shekhar Khairnar Avatar asked May 20 '15 12:05

Shekhar Khairnar


People also ask

Where is Jboss Home Path in Linux?

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.

How to set JBoss_home variable in JBoss?

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>\ .

How do I find the JBoss Application Server in my environment?

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).

What is the JBoss_home environment variable for the restcommone platform?

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.

How do I set environment variables in Windows 10?

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.


1 Answers

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)

like image 68
maress Avatar answered Oct 09 '22 15:10

maress