Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
153 views
in Technique[技术] by (71.8m points)

weblogic11g - Custom arguments to set in Weblogic JVM

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...