Bamboo Data Center Agents cannot start: Unable to locate the class com.atlassian.bamboo.agent.bootstrap.AgentBootstrap
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When trying to start up a Bamboo agent, it fails and the <bamboo-agent-home>/
atlassian-bamboo-agent.log
shows the following error:
WrapperSimpleApp Error: Unable to locate the class com.atlassian.bamboo.agent.bootstrap.AgentBootstrap : java.lang.ClassNotFoundException: com.atlassian.bamboo.agent.bootstrap.AgentBootstrap
Even after reinstalling the agent, it still fails during the bootstrap.
Environment
The solution has been validated in Bamboo Data Center 10.1 but may be applicable to other versions.
Diagnosis
We can see in the <bamboo-agent-home>/
atlassian-bamboo-agent.log
file the agent wrapper starting and failing during the bootstrap:
Running [/bin/bamboo-agent.sh, console]
Agent process started, shutdown hook registered, proceeding with log pump...
Running Bamboo Agent...
STATUS | wrapper | 2023/02/14 11:39:58 | --> Wrapper Started as Console
STATUS | wrapper | 2023/02/14 11:39:58 | Java Service Wrapper Standard Edition 64-bit 3.5.39
STATUS | wrapper | 2023/02/14 11:39:58 | Copyright (C) 1999-2019 Tanuki Software, Ltd. All Rights Reserved.
STATUS | wrapper | 2023/02/14 11:39:58 | http://wrapper.tanukisoftware.com
STATUS | wrapper | 2023/02/14 11:39:58 | Licensed to Atlassian Pty Ltd for Bamboo Remote Agent
STATUS | wrapper | 2023/02/14 11:39:58 |
STATUS | wrapper | 2023/02/14 11:39:58 | Launching a JVM...
INFO | jvm 1 | 2023/02/14 11:39:58 | WrapperManager: Initializing...
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperSimpleApp Error: Unable to locate the class com.atlassian.bamboo.agent.bootstrap.AgentBootstrap : java.lang.ClassNotFoundException: com.atlassian.bamboo.agent.bootstrap.AgentBootstrap
INFO | jvm 1 | 2023/02/14 11:39:59 |
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperSimpleApp Usage:
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperManager Error: Error in WrapperListener.start callback. java.lang.IllegalArgumentException: can't parse argument number: app_class{/app_method}
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperManager Error: java.lang.IllegalArgumentException: can't parse argument number: app_class{/app_method}
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperManager Error: at java.text.MessageFormat.makeFormat(MessageFormat.java:1429)
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperManager Error: at java.text.MessageFormat.applyPattern(MessageFormat.java:479)
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperManager Error: at java.text.MessageFormat.<init>(MessageFormat.java:362)
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperManager Error: at java.text.MessageFormat.format(MessageFormat.java:840)
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperManager Error: at org.tanukisoftware.wrapper.WrapperResources.getString(WrapperResources.java:215)
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperManager Error: at org.tanukisoftware.wrapper.WrapperSimpleApp.showUsage(WrapperSimpleApp.java:621)
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperManager Error: at org.tanukisoftware.wrapper.WrapperSimpleApp.start(WrapperSimpleApp.java:465)
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperManager Error: at org.tanukisoftware.wrapper.WrapperManager$11.run(WrapperManager.java:4430)
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperManager Error: Caused by: java.lang.NumberFormatException: For input string: "app_class{/app_method}"
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperManager Error: at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperManager Error: at java.lang.Integer.parseInt(Integer.java:580)
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperManager Error: at java.lang.Integer.parseInt(Integer.java:615)
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperManager Error: at java.text.MessageFormat.makeFormat(MessageFormat.java:1427)
INFO | jvm 1 | 2023/02/14 11:39:59 | WrapperManager Error: ... 7 more
STATUS | wrapper | 2023/02/14 11:40:00 | <-- Wrapper Stopped
Cause
The Bamboo Data Center machine has a corrupted bamboo-agent-bootstrap.jar file due to improper shutdown or startup procedures, hardware failures, or NFS write errors. In that event, since the Bamboo Remote agents will always synchronise its packages with the files that are provided by the Bamboo Server as per Do I need to manually upgrade my Bamboo Agents? - The bootstrap auto-upgrade process, the Agents will end up downloading a copy of it during their bootstrap and consequently break their operations.
All agent activity is recorded in atlassian-bamboo-agent.log file stored on the agent machine. These are generated in the running directory of the agent. The running directory can be viewed in the remote agent's system properties under the Bamboo paths section.
INFO | jvm 1 | 2023/02/15 14:05:22 | 2023-02-15 14:05:22,538 INFO [WrapperSimpleAppMain] [BootstrapUpdater] Checking if bootstrap /home/bamboo/bamboo-agent-home/lib/bamboo-agent-bootstrap.jar is up to date, using url: https://bamboo.mydomain.net/agentServer/GetJar?name=bootstrap-with-deps&checksum=545918294
INFO | jvm 1 | 2023/02/15 14:05:22 | 2023-02-15 14:05:22,568 INFO [WrapperSimpleAppMain] [BootstrapUpdater] New bootstrap is available, proceeding with update...
INFO | jvm 1 | 2023/02/15 14:05:22 | 2023-02-15 14:05:22,713 INFO [WrapperSimpleAppMain] [BootstrapUtils] /tmp/bamboo-bootstrap2855653741552301166.tmp: 2 MBs transferred
INFO | jvm 1 | 2023/02/15 14:05:22 | 2023-02-15 14:05:22,720 INFO [WrapperSimpleAppMain] [BootstrapUpdater] Bootstrap has been downloaded, updating file...
INFO | jvm 1 | 2023/02/15 14:05:22 | 2023-02-15 14:05:22,723 INFO [WrapperSimpleAppMain] [BootstrapUtils] /home/bamboo/bamboo-agent-home/lib/bamboo-agent-bootstrap.jar: 2 MBs transferred
INFO | jvm 1 | 2023/02/15 14:05:22 | 2023-02-15 14:05:22,725 INFO [WrapperSimpleAppMain] [BootstrapUpdater] Bootstrap successfully updated.
INFO | jvm 1 | 2023/02/15 14:05:22 | 2023-02-15 14:05:22,725 INFO [WrapperSimpleAppMain] [AgentContext] Important agent classes have been updated, the agent will now terminate to pick up the latest changes.
STATUS | wrapper | 2023/02/15 14:05:24 | on_exit trigger matched. Restarting the JVM. (Exit code: 1)
Solution
To fix the Remote Agents, you need to restore the correct files on the Bamboo server and restart each Agent individually so they can pick up the correct package versions and start working again. The most guaranteed method to recover your Bamboo operations to a safe state would be either restoring from a backup or a snapshot, including a copy of the database state.
You can also explore alternative recovery methods such as copying the contents of an original copy of Bamboo from the Bamboo installation archive to the <bamboo-install> folder. Since this will overwrite the current install folder, you need to make the required manual changes to the configuration files in:
<bamboo-install>/conf
<bamboo-install>/bin
<bamboo-install>/atlassian-bamboo/WEB-INF/classes