Reputation: 537
I'm creating a custom property in my WebSphere Application Server (ND 8.5.0.2) at below path as prescribed by plenty of articles on web: Application servers > SamplesServer > Process definition > Java Virtual Machine > Custom properties
As per the articles, I can access this custom property using
System.getProperty("PropertyName");
However, it always returns NULL. I tried all the possible ways and done plenty of Googling but yet to retrieve this property.
Upvotes: 0
Views: 1059
Reputation: 11
Also, you can specify system properties in the "Generic JVM Arguments" field of the Java Virtual Machine configuration mentioned in your question. Here's a technote with the procedure: http://www-01.ibm.com/support/docview.wss?uid=swg21417365. Add each property in the form -DpName=pValue. For example: -Dcom.ibm.ws.example=true
If you are using a Deployment Manager to configure these settings, please ensure that you synchronize the configuration after saving the settings.
Upvotes: 1
Reputation: 24060
If you run:
$ jcmd <pid> VM.system_properties
from the host your server is running on, it will print out all system properties identified by that JVM. If you don't know what the pid is, then you can run:
$ jps
and it will show you a list of all processes along with their ids that you can use to connect to to find this information.
That will tell you whether the problem is in the way that you're setting the property, or in your code. However, from the above the code looks correct, which suggests that the custom property isn't being set in the way you are launching the process.
Upvotes: 0