Hello
 
In geoserver 2.20.x the startup.sh of the platform independent binary distribution has been refactored
 
2.19.x:
exec "$_RUNJAVA" $JAVA_OPTS $MARLIN_ENABLER -DGEOSERVER_DATA_DIR="$GEOSERVER_DATA_DIR" -Djava.awt.headless=true -DSTOP.PORT=8079 -DSTOP.KEY=geoserver -jar start.jar 
 
2.20.x:
IFS=$(printf '\n\t')
...
exec "${_RUNJAVA}" "${JAVA_OPTS:--DNoJavaOpts}" "${MARLIN_ENABLER:--DMarlinDisabled}" "${RENDERER:--DDefaultrenderer}" "-Djetty.base=${GEOSERVER_HOME}" "-DGEOSERVER_DATA_DIR=${GEOSERVER_DATA_DIR}" -Djava.awt.headless=true -DSTOP.PORT=8079 -DSTOP.KEY=geoserver -jar "${GEOSERVER_HOME}/start.jar"
 
 
This doesn't allow setting multiple parameters in JAVA_OPTS anymore because it will be passed to exec as one argument.
 
 
Reproduce like this:
1. Download and extract the zip file
2. cd geoserver-2.20.2-bin
3. export JAVA_OPTS="-Xms512m -Xmx1g"
4. bin/startup.sh
 
Result:
GEOSERVER_HOME environment variable not found, using current
directory.  If not set then running this script from other
directories will not work in the future.
GEOSERVER DATA DIR is /vagrant/geoserver-2.20.2-bin/data_dir
Invalid initial heap size: -Xms512m -Xmx1g
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
 
 
 
By setting set -x before the call one can see that the parameters are passed as one argument:
+ exec java '-Xms512m -Xmx1g' -Xbootclasspath/a:/vagrant/geoserver-2.20.2-bin/webapps/geoserver/WEB-INF/lib/marlin-0.9.3.jar -Dsun.java2d.renderer=org.marlin.pisces.MarlinRenderingEngine -Djetty.base=/vagrant/geoserver-2.20.2-bin -DGEOSERVER_DATA_DIR=/vagrant/geoserver-2.20.2-bin/data_dir -Djava.awt.headless=true -DSTOP.PORT=8079 -DSTOP.KEY=geoserver -jar /vagrant/geoserver-2.20.2-bin/start.jar
 
 
By removing 'IFS=$(printf '\n\t')' and removing the quotation marks from "${JAVA_OPTS:--DNoJavaOpts}" this will work again:
+ exec java -Xms512m -Xmx1g -Xbootclasspath/a:/vagrant/geoserver-2.20.2-bin/webapps/geoserver/WEB-INF/lib/marlin-0.9.3.jar -Dsun.java2d.renderer=org.marlin.pisces.MarlinRenderingEngine -Djetty.base=/vagrant/geoserver-2.20.2-bin -DGEOSERVER_DATA_DIR=/vagrant/geoserver-2.20.2-bin/data_dir -Djava.awt.headless=true -DSTOP.PORT=8079 -DSTOP.KEY=geoserver -jar /vagrant/geoserver-2.20.2-bin/start.jar
 
 
I guess the same applies to other variables if the contain multiple arguments.
 
Would be great if setting multiple parameters in JAVA_OPTS will be supported again.
 
 
Regards,
Björn
 
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to