问题描述
我需要在 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:
- 在域结构窗格中,展开服务器节点.
- 单击要配置的服务器的名称.
- 在右窗格中,单击服务器启动.
- 选择锁定 &编辑.
- 在参数文本框中,提供 JVM 选项.插入选项后,单击保存.然后单击激活更改.
- 重新启动服务器以使用新设置.
我的问题是参数是如何定义的?如何在将部署在该 JVM 中的应用程序中使用该参数.
My question is how exactly the argument is defined? How to use that argument inside the application that will be deployed inside that JVM.
编辑
如果我指定,-DMyArg=MyValue
在代码中,value=System.getproperty("MyValue");
应该可以,对吧?
If i specify, -DMyArg=MyValue
and in the code, value=System.getproperty("MyValue");
this should work, right?
推荐答案
轻微错误,你应该使用
value=System.getProperty("MyArg");
但这仅适用于启用了 NodeManager.如果不是这种情况,我所做的就是在 startWeblogic.cmd 中将其设置为 Java_Options 之一
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
更好的是 setDomainEnv.cmd,它有
Even better is the setDomainEnv.cmd which has lines for
set EXTRA_JAVA_PROPERTIES=...
这篇关于在 Weblogic JVM 中设置的自定义参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!