Monday, 25 June 2012

Using System.property in Weblogic

Using System.property in Weblogic


Recently there was a need for changing application server base on customer request, deployment of our Jboss base Ejb application was to be transfered to Weblogic. one of my thorn issues was that i had to find a solution to setting weblogic configuration path so that my application can request it from the application Server as will.
What needed to be done are as follow:
  • Locate this file 'startWebLogic.cmd' in <Weblogic>Middleware\user_projects\domains\base_domain\bin\
  • Then Open with notepad
  • Then locate or search for 'set JAVA_OPTIONS' then paste or type configuration you want weblogic to config for you
set JAVA_OPTIONS=%SAVE_JAVA_OPTIONS% -DMY_CONFIG_PATH=C:\Config

then at your java code u can have something like the below.

String myConfig = System.getProperty("MY_CONFIG_PATH");
System.out.println(myConfig);

Output:
  C:\Config