Custom arguments to set in Weblogic JVM

priceline picture priceline · Nov 16, 2011 · Viewed 69.4k times · Source

I need a custom property to set per each server JVM in Weblogic. What is the better approach doing it?

I know we can specify the argments like below:

  1. In the Domain Structure pane, expand the Servers node.
  2. Click the name of the server that you want to configure.
  3. In the right pane, click Server Start.
  4. Select Lock & Edit.
  5. In the Arguments text box, provide the JVM options. After inserting your options, click Save. Then click Activate Changes.
  6. Restart the server so that the new settings are used.

My question is how exactly the argument is defined? How to use that argument inside the application that will be deployed inside that JVM.

Edit

If i specify, -DMyArg=MyValue and in the code, value=System.getproperty("MyValue"); this should work, right?

Answer

JoseK picture JoseK · Nov 17, 2011

Edit: if i specify, "-DMyArg=MyValue" and in the code, value=System.getproperty("MyValue"); this should work, right?

Slight mistake, you should use

value=System.getProperty("MyArg");

This however only works with NodeManager enabled. If that's not the case, what I do is to set it in the startWeblogic.cmd as one of the Java_Options

Even better is the setDomainEnv.cmd which has lines for

set EXTRA_JAVA_PROPERTIES=...