ERROR: There are syntax errors in '/opt/amq/bin/env'
Looking at this file, it contains jvm options that are generated by the launch.sh script:
sh-4.2$ cat env
ACTIVEMQ_OPTS=" -Xms1024m -Xmx1024m -XX:+UseParallelGC -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=100m -XX:ParallelGCThreads=1 -Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -XX:CICompilerCount=2 -XX:+ExitOnOutOfMemoryError -javaagent:/opt/jolokia/jolokia.jar=config=/opt/jolokia/etc/jolokia.properties -Djava.security.egd=file:/dev/./urandom -Dhttps.proxyHost=172.21.9.152 -Dhttps.proxyPort=80 -Dhttp.proxyHost=172.21.9.152 -Dhttp.proxyPort=80 -Dhttp.nonProxyHosts=".cluster.local|172.22.0.1|172.22.240.36|host-dr-01.local.mydomain.com|host-dr-02.local.mydomain.com|host-drext-01.local.mydomain.com|host-drext-02.local.mydomain.com|host-es-01.local.mydomain.com|host-es-02.local.mydomain.com|host-es-03.local.mydomain.com|host-etcd-01.local.mydomain.com|host-etcd-02.local.mydomain.com|host-etcd-03.local.mydomain.com|host-master-01.local.mydomain.com|host-master-02.local.mydomain.com|host-node-01.local.mydomain.com|host-node-02.local.mydomain.com|host-node-03.local.mydomain.com|host-node-04.local.mydomain.com|host-node-05.local.mydomain.com|host-node-06.local.mydomain.com|host-pnode-01.local.mydomain.com|host-pnode-02.local.mydomain.com|host-pnode-03.local.mydomain.com|host-pnode-04.local.mydomain.com|host-pnode-05.local.mydomain.com|host-pnode-06.local.mydomain.com|local.mydomain.com|localhost|myd.com|myservices.org" "
As you can see, the http.nonProxyHosts property value contains quotes, which should be escaped when used in a shell variable assignment, if the assignment itself is also inside quotes.
I tracked the problem to the script /opt/run-java/proxy-options, where the nonProxyHosts are created with quotes. By adding another pair backslashes to escape the quotes when the variable is used, I was able to work around the problem.
before (proxy-options line 45):
ret="$ret -Dhttp.nonProxyHosts=\"$(echo $noProxy | sed -e 's+,+|+g')\""
after:
ret="$ret -Dhttp.nonProxyHosts=\\\"$(echo $noProxy | sed -e 's+,+|+g')\\\""
- is caused by
-
CLOUD-1951 When the http.nonProxyHosts property value contains quotes they are not escaped properly and /opt/amq/bin/env reports syntax errors
- Verified