How to Set a System Property
This content applies to Weave 2.5.
Weave 2.6 system properties should be set in a file in the ...\weave\jetty_base\start.d\
directory.
There are various internal settings within Weave that globally alter the way the server functions. These settings can be altered by setting a "system property" which is read when the server starts up.
Occasionally you'll have to set a system property to alter the way the server behaves, to address a support ticket for example, and here we'll describe how that can be done.
Depending upon how you start Weave there are two places where system properties can be set. If you start Weave as a service the properties are set in ...\weave\service\conf\wrapper.conf
, and if you start Weave via startup.cmd
or startup.sh
the properties are set directly in that file.
No matter where the system property is defined, wrapper.conf
or startup.cmd/startup.sh
, what we will accomplish here is the passing of a new command line parameter to the Weave server process. The command line parameter we're trying to pass to the server process is specified in the format -Dname=value
. The -D
tells the Java process that we're defining a new property, name
is the name of the property we're creating and value
is what we want to set it to. As we do not start the Weave server process manually and rely on the service wrapper or startup.cmd/startup.sh
to do it for us, what we're outlining here is how we tell them to pass the new command line parameter to the process when it starts.
The setting of a system property, as described here, is only a subset of the things we can do with command line parameters set in the wrapper.conf
or startup.cmd/startup.sh
, but this How-to page will only cover setting system properties.
Instructions
Setting a system property in wrapper.conf
- Open
...\weave\service\conf\wrapper.conf
in the text editor of your choice. - Locate the last additional property in the file (they are usually defined at the end of the file)
- The "additional properties" are those listed in the form
wrapper.java.additional.## = ...
- The "additional properties" are those listed in the form
- Find the number of the last set additional property, and increase it by one.
- Create a new additional property, by duplicating an existing one, increment the property number, and set the value to
-Dname=value.
- Note that it is important that you increment the property number, in the example below we use 22, which is assuming the previous largest property number was 21, but it might be different in your
wrapper.conf
.
- Note that it is important that you increment the property number, in the example below we use 22, which is assuming the previous largest property number was 21, but it might be different in your
- Save the file and restart Weave.
wrapper.java.additional.22 = -Dweave.spatial.operation.limit=500
Setting a system property in startup.cmd
- Open
...\weave\startup.cmd
in the text editor of your choice. - Locate the last
SET JAVA_OPTS
line in the file (they are set through the file and the last one would usually be defined near the end of the file).- The properties are those listed in the form
SET JAVA_OPTS=%JAVA_OPTS% -D...=...
- There are a number of these lines through the file, that concatenate different system properties into a single
JAVA_OPTS
variable that is then passed to the Java process at the end of the file.
- The properties are those listed in the form
- Create a new
SET JAVA_OPTS
line after the last one with the format:SET JAVA_OPTS=%JAVA_OPTS% -Dname=value
- Save the file and restart Weave.
SET JAVA_OPTS=%JAVA_OPTS% -Dweave.spatial.operation.limit=500
Setting a system property in startup.sh
- Open
...\weave\startup.sh
in the text editor of your choice. - Locate the last
JAVA_OPTS="$JAVA_OPTS ..."
line in the file (they are set through the file and the last one would usually be defined near the end of the file).- The properties are those listed in the form
JAVA_OPTS="$JAVA_OPTS -D...=..."
- There are a number of these lines through the file, that concatenate different system properties into a single
JAVA_OPTS
variable that is then passed to the Java process at the end of the file.
- The properties are those listed in the form
- Create a new
JAVA_OPTS
line after the last one with the format:JAVA_OPTS="$JAVA_OPTS -Dname=value"
- Save the file and restart Weave.
JAVA_OPTS="$JAVA_OPTS -Dweave.spatial.operation.limit=500"
Example of customised wrapper.conf with weave.spatial.operation.limit set to 500
... there's more content before here
#********************************************************************
# genConfig: further Properties generated by genConfig
#********************************************************************
placeHolderSoGenPropsComeHere=
wrapper.java.app.jar = .\/start.jar
wrapper.app.parameter.1 = --ini=..\/jetty.ini
wrapper.java.additional.1 = -server
wrapper.java.additional.2 = -XX:PermSize=64M -XX:MaxPermSize=192M
wrapper.java.additional.3 = -XX:+HeapDumpOnOutOfMemoryError
wrapper.java.additional.4 = -Dfile.encoding=UTF-8
wrapper.java.additional.5 = -Dhttp.agent=weave/2.5 -Dhttpclient.useragent=weave/2.5
wrapper.java.additional.6 = -Djava.awt.headless=true
wrapper.java.additional.7 = -Djava.net.preferIPv4Stack=true
wrapper.java.additional.8 = -Dorg.eclipse.jetty.server.Request.maxFormContentSize=1000000
wrapper.java.additional.9 = -Dorg.geotools.referencing.forceXY=true
wrapper.java.additional.10 = -Dorg.apache.jasper.compiler.disablejsr199=true
wrapper.java.additional.11 = -Dosgi.clean=true
# set the console port for telneting into Weave.
wrapper.java.additional.12 = -Dosgi.console=9001
wrapper.java.additional.13 = -Dweave.spatial.operation.limit=500
Example of customised startup.cmd with weave.spatial.operation.limit set to 500
... there's more content before here
REM Force coordinate axis order for compatability
SET JAVA_OPTS=%JAVA_OPTS% -Dorg.geotools.referencing.forceXY=true
REM Uncomment the line below to allow a debugger to be attached
REM SET JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5000
REM Set Jetty options
SET JAVA_OPTS=%JAVA_OPTS% -DSTOP.PORT=%{jetty.shutdown.port} -DSTOP.KEY=seekrit
SET JAVA_OPTS=%JAVA_OPTS% -Dweave.spatial.operation.limit=500
cd jetty
"..\jre\bin\java.exe" %JAVA_OPTS% -jar start.jar --ini=..\jetty.ini
popd
Example of customised startup.sh with weave.spatial.operation.limit set to 500
... there's more content before here
# Force coordinate axis order for compatability
JAVA_OPTS="$JAVA_OPTS -Dorg.geotools.referencing.forceXY=true"
# Uncomment the line below to allow a debugger to be attached
#JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5000"
# Set Jetty options
JAVA_OPTS="$JAVA_OPTS -DSTOP.PORT=%{jetty.shutdown.port} -DSTOP.KEY=seekrit"
JAVA_OPTS="$JAVA_OPTS -Dweave.spatial.operation.limit=500"
cd jetty
../jre/bin/java $JAVA_OPTS -jar start.jar --ini=../jetty.ini
cd ..
Related articles