- After upgrade CloudBees CI to version 2.289.2.2 or later using RPM, the service fails to start and shows the following:
cloudbees-core-cm[xxxx]: Error: Could not find or load main class <element>
- CloudBees CI (CloudBees Core) on traditional platforms - Client controller >= 2.289.2.2
- CloudBees CI (CloudBees Core) on traditional platforms - Operations Center >= 2.289.2.2
- CloudBees Jenkins Platform - Client controller >= 2.289.2.2
- CloudBees Jenkins Platform - Operations Center >= 2.289.2.2
- Using RPM install method only
Any installation or upgrade to CloudBees CI on traditional platforms
2.289.2.2 through RPM fails in case the configuration file
/etc/sysconfig/cloudbees-core-[cm|oc] contains a java option with spaces in
JENKINS_JAVA_OPTIONS. A typical use case is the system property
hudson.model.DirectoryBrowserSupport.CSP that usually contains spaces, for example:
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.model.DirectoryBrowserSupport.CSP=\"sandbox allow-same-origin allow-scripts;style-src 'unsafe-inline' _;script-src 'unsafe-inline' _;\""
This would cause the service to fail to start with the following output in
cloudbees-core-cm[xxxx]: Error: Could not find or load main class allow-same-origin systemd: cloudbees-core-cm.service: main process exited, code=exited, status=1/FAILURE systemd: Unit cloudbees-core-cm.service entered failed state. systemd: cloudbees-core-cm.service failed. systemd: Started cloudbees-core-cm. systemd: cloudbees-core-cm.service: main process exited, code=exited, status=2/INVALIDARGUMENT
- BEE-7072: Spaces in configuration for systemd break java startup.
This issue is fixed after upgrading your instance to at least version
2.303.2.5, to prepare for upgrading, please reach out to us so we can help plan your next upgrade via an Assisted Update.
Please be aware that you may be impacted by RPM JENKINS_JAVA_OPTIONS are inlined within a single Java argument starting with 2.303.2.3 when you upgrade.
Until you are able to upgrade to a version with the fix, the workaround is to remove the system property that contains spaces from the configuration file
/etc/sysconfig/cloudbees-core-[cm|oc] and add that system property explicitly to the service script
Remove the system property from the Configuration File
/etc/sysconfig/cloudbees-core-cmon the Controller host (or
/etc/sysconfig/cloudbees-core-ocfor Operations Center)
Locate the line where the
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -D<optionName>=\"<value With Spaces>\""
Remove the system property that contains spaces (in this example
-D<optionName>=\"<value With Spaces>\")
Add the system property to the Script File
/usr/bin/cloudbees-core-cmon the Controller host (or
/usr/bin/cloudbees-core-ocfor Operations Center)
Locate the line that execute the java command (this should be the last line of the file)
$JENKINS_JAVA_CMD $JENKINS_JAVA_OPTIONS -jar $JENKINS_WAR $PARAMS
Add the system property that contains spaces before
$JENKINS_JAVA_CMD $JENKINS_JAVA_OPTIONS -D<optionName>="<value With Spaces>" -jar $JENKINS_WAR $PARAMS
Restart the service
systemctl restart cloudbees-core-[cm|oc]