How to define custom server property in weblogic server 10.3

gleX picture gleX · Sep 19, 2013 · Viewed 7.2k times · Source

I need to define some properties in the weblogic enviroment to be used for an application on the startup process. I put the properties directly in the file setDomainEnv but the application doesn't get the property with this line:

public static final String SYSVAR_ENVIROMENT = System
        .getProperty(Constants.ENVIROMENT);

I'm not sure if I declared the property correctly, can anybody help me? In others application servers this type of properties could be set by the web console, but I didn't find this way in weblogic.

Answer

Display Name is missing picture Display Name is missing · Sep 19, 2013

In Weblogic you can achieve this in two ways:

Modify startWebLogic.sh and add your properties as -D arguments along with the others that weblogic already uses like:

JAVA_OPTIONS: ${SAVE_JAVE_OPTIONS} -Dmy.property=something

Modify your server start argument via the admin console. Login to the console and:

Servers link -> <server name> -> Configuration tab -> Server Start tab

Then you can add your -D properties to the Arguments: area.

If you want to verify your java properties/options are present you can either do a ps -ef and look at the server process, you can verify in the log file that the properties are present when the server starts, or you can connect to the server via jconsole <pid> and check the VM arguments tab.