Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-17492

Update the Java version inside the Atlassian Docker images

XMLWordPrintable

      Summary

      Remote agents inside the Docker images are failing to start up with an "Unsupported major.minor version 52.0" error. This usually happens when we try to run a class compiled using a higher Java version (e.g. Java 8) compiler into a lower Java version (e.g. Java 7), because higher versions usually have features that are not supported by lower versions.

      It is necessary to update the Java version inside the Docker images provided by Atlassian at https://hub.docker.com/u/atlassian/.

      atlassian/bamboo-java-agent
      atlassian/bamboo-base-agent
      

      They're currently running Java 7, according to our doc. However remote agents 5.10.x will not start up with Java 6 or 7, it is necessary to have Java 8 installed, as per the Supported Platforms.

      Steps to Reproduce

      Follow the Getting started with Docker and Bamboo documentation to make use of the Docker images provided by Atlassian at https://hub.docker.com/u/atlassian/.

      Expected Results

      The remote agent starts up and is ready to build.

      Actual Results

      The remote agent fails to start up with the following error message:

      Running [/root/bamboo-agent-home/bin/bamboo-agent.sh, console]
      Agent process started, shutdown hook registered, proceeding with log pump...
      Running Bamboo Agent...
      STATUS | wrapper  | 2016/04/26 13:32:49 | --> Wrapper Started as Console
      STATUS | wrapper  | 2016/04/26 13:32:50 | Launching a JVM...
      INFO   | jvm 1    | 2016/04/26 13:32:50 | Wrapper (Version 3.2.3-atlassian-1) http://wrapper.tanukisoftware.org
      INFO   | jvm 1    | 2016/04/26 13:32:50 |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
      INFO   | jvm 1    | 2016/04/26 13:32:50 |
      INFO   | jvm 1    | 2016/04/26 13:32:50 | 2016-04-26 13:32:50,304 INFO [WrapperSimpleAppMain] [AgentBootstrap] Starting Agent Bootstrap using Java 1.7.0_65 from Oracle Corporation Default charset: US-ASCII
      INFO   | jvm 1    | 2016/04/26 13:32:50 | 2016-04-26 13:32:50,306 INFO [WrapperSimpleAppMain] [AgentBootstrap] Agent bootstrap using baseUrl: http://192.168.10.80:8086/agentServer/
      INFO   | jvm 1    | 2016/04/26 13:32:50 | 2016-04-26 13:32:50,646 INFO [WrapperSimpleAppMain] [RemoteAgentHomeLocatorForBootstrap] Using agent home located at [/root/bamboo-agent-home]
      INFO   | jvm 1    | 2016/04/26 13:32:50 | 2016-04-26 13:32:50,646 INFO [WrapperSimpleAppMain] [RemoteAgentHomeLocatorForBootstrap] Using agent home located at [/root/bamboo-agent-home]
      INFO   | jvm 1    | 2016/04/26 13:32:50 | 2016-04-26 13:32:50,647 INFO [WrapperSimpleAppMain] [AgentUuidInitializer] Generating new UUID for this agent: f461244e-5c42-4fce-8519-e16b6ddc5e8d
      INFO   | jvm 1    | 2016/04/26 13:32:50 | 2016-04-26 13:32:50,654 INFO [WrapperSimpleAppMain] [AgentContext] Requesting fingerprint, url: http://192.168.10.80:8086/agentServer/GetFingerprint.action?hostName=3dd9d657ebd1&version=3&agentUuid=f461244e-5c42-4fce-8519-e16b6ddc5e8d
      INFO   | jvm 1    | 2016/04/26 13:32:50 | 2016-04-26 13:32:50,772 WARN [WrapperSimpleAppMain] [AgentContext]
      INFO   | jvm 1    | 2016/04/26 13:32:50 |
      INFO   | jvm 1    | 2016/04/26 13:32:50 | ********************************************************************************
      INFO   | jvm 1    | 2016/04/26 13:32:50 | *
      INFO   | jvm 1    | 2016/04/26 13:32:50 | * This agent requires manual approval. Message from the server is:
      INFO   | jvm 1    | 2016/04/26 13:32:50 | * Approve this agent at 'http://webserver.bamboo/admin/agent/viewAgents.action?focusUuid=f461244e-5c42-4fce-8519-e16b6ddc5e8d&selectedTab=Agent+authentication'. Check that the IP is correct.
      INFO   | jvm 1    | 2016/04/26 13:32:50 | * Next authentication attempt in 60 seconds...
      INFO   | jvm 1    | 2016/04/26 13:32:50 | *
      INFO   | jvm 1    | 2016/04/26 13:32:50 | ********************************************************************************
      INFO   | jvm 1    | 2016/04/26 13:32:50 |
      INFO   | jvm 1    | 2016/04/26 13:33:50 | 2016-04-26 13:33:50,791 INFO [WrapperSimpleAppMain] [AgentContext] Successfully authenticated with Bamboo server at http://192.168.10.80:8086/agentServer/
      INFO   | jvm 1    | 2016/04/26 13:33:50 | 2016-04-26 13:33:50,797 INFO [WrapperSimpleAppMain] [BootstrapUpdater] Checking if bootstrap /root/bamboo-agent-home/lib/bamboo-agent-bootstrap.jar is up to date, using url: http://192.168.10.80:8086/agentServer/GetJar?name=bootstrap-with-deps&checksum=16552062&fingerprint=-7795811455529438540
      INFO   | jvm 1    | 2016/04/26 13:33:50 | 2016-04-26 13:33:50,805 INFO [WrapperSimpleAppMain] [BootstrapUpdater] New bootstrap is available, proceeding with update...
      INFO   | jvm 1    | 2016/04/26 13:33:50 | 2016-04-26 13:33:50,828 INFO [WrapperSimpleAppMain] [BootstrapUpdater] Bootstrap has been downloaded, updating file...
      INFO   | jvm 1    | 2016/04/26 13:33:50 | 2016-04-26 13:33:50,831 INFO [WrapperSimpleAppMain] [BootstrapUpdater] Bootstrap successfully updated.
      INFO   | jvm 1    | 2016/04/26 13:33:50 | 2016-04-26 13:33:50,831 INFO [WrapperSimpleAppMain] [AgentContext] Important agent classes have been updated, the agent will now terminate to pick up the latest changes.
      ERROR  | wrapper  | 2016/04/26 13:33:51 | JVM exited unexpectedly.
      STATUS | wrapper  | 2016/04/26 13:33:55 | Launching a JVM...
      INFO   | jvm 2    | 2016/04/26 13:33:55 | Wrapper (Version 3.2.3-atlassian-1) http://wrapper.tanukisoftware.org
      INFO   | jvm 2    | 2016/04/26 13:33:55 |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
      INFO   | jvm 2    | 2016/04/26 13:33:55 |
      INFO   | jvm 2    | 2016/04/26 13:33:55 | WrapperSimpleApp: Unable to locate the class com.atlassian.bamboo.agent.bootstrap.AgentBootstrap: java.lang.UnsupportedClassVersionError: com/atlassian/bamboo/agent/bootstrap/AgentBootstrap : Unsupported major.minor version 52.0
      INFO   | jvm 2    | 2016/04/26 13:33:55 |
      INFO   | jvm 2    | 2016/04/26 13:33:55 | WrapperSimpleApp Usage:
      INFO   | jvm 2    | 2016/04/26 13:33:55 |   java org.tanukisoftware.wrapper.WrapperSimpleApp {app_class} [app_arguments]
      INFO   | jvm 2    | 2016/04/26 13:33:55 |
      INFO   | jvm 2    | 2016/04/26 13:33:55 | Where:
      INFO   | jvm 2    | 2016/04/26 13:33:55 |   app_class:      The fully qualified class name of the application to run.
      INFO   | jvm 2    | 2016/04/26 13:33:55 |   app_arguments:  The arguments that would normally be passed to the
      INFO   | jvm 2    | 2016/04/26 13:33:55 |                   application.
      STATUS | wrapper  | 2016/04/26 13:33:57 | <-- Wrapper Stopped
      Waiting for the agent process to finish...
      Underlying agent process has terminated cleanly,
      Bamboo Agent Installer is shutting down, the underlying agent process has already been shut down.
      

      Workaround

      Step 1: Customization

      To customize an image, run it in a container. Name the container for easier access later. In this example we will call it ATL:

      1. sudo docker run --name="ATL" -e HOME=/root/ -i -t atlassian/bamboo-java-agent:latest /bin/bash

        Once you run this command you'll get automatically logged in to the container.

      Step 2: Install additional Ubuntu packages

      We have to add some packages to Ubuntu so we can install Java through the command line:

      1. sudo apt-get install python-software-properties
      2. sudo apt-get update
      3. sudo apt-get install software-properties-common
      Step 3: Install Java

      In this example we will download Java 8 from the Webup8 repository. In this step you can use any repository you want to download Java 8 from. This is only one example of repository that you can use to download Java 8 from. Use this at your own risk.

      1. sudo add-apt-repository ppa:webupd8team/java
      2. sudo apt-get update
      3. sudo apt-get install oracle-java8-installer

      Now we have to set up the Java 8 environment variables:

      1. sudo apt-get install oracle-java8-set-default
      2. export JAVA_HOME=path/to/jdk/install
      3. export PATH=$JAVA_HOME/bin:$PATH
      Step 4: Building your own image

      Here you will create a new image from the container you've installed Java 8. Without closing the terminal window you're using to access the container, open a new terminal window and run:

      1. sudo docker commit ATL customized-bamboo-java-agent:1.0.0
      Step 5: Verify your custom image

      Run the following command from the terminal window to check your current docker images. You should see your customized image named customized-bamboo-java-agent in the list with TAG 1.0.0.

      1. docker images
      Step 6: Start your customized Docker image
      1. sudo docker run -e HOME=/root/ -e BAMBOO_SERVER=http://hostname:port/bamboo -i -t customized-bamboo-java-agent:1.0.0

              jmajkutewicz Jan Majkutewicz (Inactive)
              brosa Bruno Rosa
              Votes:
              13 Vote for this issue
              Watchers:
              19 Start watching this issue

                Created:
                Updated:
                Resolved: