Apps crash and Apply Changes fails after upgrade to Spring Cloud Services version 3.2.x
search cancel

Apps crash and Apply Changes fails after upgrade to Spring Cloud Services version 3.2.x

book

Article ID: 380184

calendar_today

Updated On:

Products

VMware Tanzu Application Service

Issue/Introduction

Apply Changes fails when upgrading to Spring Cloud Services (SCS) version 3.2.x and causes apps to crash:

# From Apply Changes:
Running "/usr/local/bin/bosh --no-color --non-interactive --tty --environment=xx.xx.xx.xx --deployment=p_spring-cloud-services-abcdefghijk1234f67a run-errand upgrade-all-instances --instance spring-cloud-services/first":
Errand 'upgrade-all-instances' completed with error (exit code 1)
Exit code 1
Stderr     Error: failed to run job-process: exit status 1 (exit status 1)  

# From SCS config-server logs:
Caused by: org.springframework.boot.context.config.InvalidConfigDataPropertyException: Property 'spring.profiles' imported from location ...
 is invalid and should be replaced with 'spring.config.activate.on-profile'

Environment

Cause

If the Sring/SCS version used to create/edit apps is < v3.2.x and the user trys to run said apps in SCS v3.2.x then face the below problem.

  • The problem arises from applications using the below outdated Spring configuration method for defining profiles:
spring:
  profiles:
    PROFILENAME
  • Previously, the above values would lead to only generating a warning, but with recent updates, it now results in an error and causes app issues (i.e. prevents the application from starting, failing errand, etc ). After upgrading to Spring Cloud Services (SCS) version 3.2.x, this deprecated method became completely incompatible. As a result, when applications restart and attempt to access configuration, the old YAML format causes the SCS v3.2.x config server to raise an error, halting the application startup and throwing error in Apply Changes.

Resolution

Update the configuration on the affected config-server as described below and re-run the above mentioned 'upgrade-all-instances' errand:

 

1. Update the YAML configuration in the config server repository by removing the following:

spring:
  profiles:
    PROFILENAME

 

2. If using Spring Boot version 2.4 or higher, add:

spring:
  config:
    activate:
      on-profile: PROFILENAME

 

3. If using a version lower than 2.4, rename the config file:

# from: 
configfilename.yaml 

# to: 
configfilename-PROFILENAME.yaml