PDA

View Full Version : How to set a system property?



snicoll
Apr 20th, 2011, 07:56 AM
I am trying to set a system property on TC server 2.2.1

I tried to update the setenv.bat file in the bin directory of my instance but it didn't worked. The documentation is not very clear on that subject. I mainly use the "run" goal (i.e. run tc server as a foreground process).

I am using the developer edition (without STS)

Thanks
S.

Andy Wilkinson
Apr 21st, 2011, 03:11 AM
If you start tc Server on Windows with run (or start), it'll run using the Java Service Wrapper. This means that VM configuration, including system properties, is defined in the wrapper.conf file rather than setenv.bat. System properties are set using wrapper.java.additional.n (http://wrapper.tanukisoftware.com/doc/english/prop-java-additional-n.html).

snicoll
Apr 21st, 2011, 03:14 AM
Okay thanks for the response. This is eventually what I was about to try. Is there any other way to start TC server so that I can pass arguments more easily (I don't need to windows service stuff yet)

If the setEnv.bat is not used, can you tell me why it's there?

Thanks!

Andy Wilkinson
Apr 21st, 2011, 03:20 AM
You can start tc Server using batch, i.e. tcruntime-ctl.bat instance-name batch. This'll start it as a foreground process without using the Java Service Wrapper. You can then use setenv.bat for its JVM configuration.

snicoll
Apr 21st, 2011, 10:41 AM
for the record:

If you want to use the run goal: tcruntime-ctl.bat run just edit your $TC_SERVER$/conf/wrapper.conf and add extra system property to the wrapper.java.additional.XX (please make sure to follow the numbers. At the time of writing the latest value is 13 so you should add something like this

wrapper.java.additional.14="-DmySystemKey=myValue"

You can also patch your setenv.bat but in that case you must run the following command

tcruntime-ctl.bat batch

Thanks for the help !

ShagVT
May 6th, 2011, 10:51 AM
This doesn't seem to work as advertised.

--- wrapper.conf ---
wrapper.java.additional.10="-Djavax.net.ssl.keyStore=xxxxxx"
wrapper.java.additional.11="-Djavax.net.ssl.keyStorePassword=xxxxx"


--- in my app ---
System.out.println("keyStore=" + System.getProperty("javax.net.ssl.keyStore"));
System.out.println("keyStorePassword=" + System.getProperty("javax.net.ssl.keyStorePassword"));


--- console output ---

keyStore=null
keyStorePassword=null

ShagVT
May 6th, 2011, 11:00 AM
Sorry, probably worthwhile to mention that this is using STS 2.3.2 and tcServer 6.0.20. I'd like to try upgrading, but a mix of plugins that we use makes that prohibitive.

snicoll
May 7th, 2011, 01:05 AM
It all depends how STS starts tc server. Try to run it on the command line (with the "run" option)

Andy Wilkinson
May 9th, 2011, 02:45 AM
Sorry, probably worthwhile to mention that this is using STS 2.3.2 and tcServer 6.0.20. I'd like to try upgrading, but a mix of plugins that we use makes that prohibitive.

STS doesn't use the service wrapper to launch the instance. Instead, you should add the system property to the launch configuration for the server within STS.