Pivotal Knowledge Base

Follow

Pivotal Cloud Foundy Spring Cloud Services 1.3.2: Unable to Create Service

Environment 

 Product  Version
 Spring Cloud® Services for Pivotal Cloud  Foundry  1.3.2

Symptom

Create service fails with errors after upgrading to Spring Cloud Services (SCS) 1.3.2.

For example,

cf create-service p-service-registry standard service-registry-test

Server error, status code: 502, error code: 10001, message: The service broker rejected the request to https://spring-cloud-broker.xxxx.pivotal.io/v2/service_instances/5d71188f-xxxx-xxxx-xxxx-a301eeb8f1da?accepts_incomplete=true.
Status Code: 404 Not Found, Body: 404 Not Found: Requested route ('spring-cloud-broker.xxxx.pivotal.io') does not exist.

Analysis

Check for the spring-cloud-broker app in Org system and Space p-spring-cloud-services to see if the spring-cloud-broker is either crashed, stopped or unavailable.

  • cf target -o system -s p-spring-cloud-services
  • cf apps
Getting apps in org system / space p-spring-cloud-services as admin...
OK

name requested state instances memory disk urls
spring-cloud-broker stopped 1/1 1G 1G spring-cloud-broker.xxxx.pivotal.io
spring-cloud-broker-worker started 1/1 1G 1G spring-cloud-broker-worker.xxxx.pivotal.io

 

If the spring-cloud-broker is either crashed or stopped, try to stop and start the app:

  • cf stop spring-cloud-broker
  • cf start spring-cloud-broker

Check for app logs:

  • cf logs spring-cloud-broker --recent

In the output, we'll see this specific error:

ERR Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContextInitializer
ERR at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
ERR at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
ERR at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
ERR at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

Resolution

Check the java build packs as per the Spring Cloud Services Troubleshooting Guide:

  • Login to the PCF deployment: cf login -a <API-Endpoint>
  • Run: cf buildpacks
  • Make sure the java build pack is equal to or higher than version 3.8
  • If the java build pack is version 3.7 or below, follow these steps:
    • Download the latest java offline build pack from Pivotal Network Download Page
    • Create a custom offline build pack: cf create-buildpack java-buildpack_offline_new <name-of-java-buildpack-zip-file-downloaded> 1 --enable
      • The number 1 before --enable puts this build pack to the top of the list
  • To make sure that the java build pack is the default build pack used, we need to deploy the broker again to pick the correct build pack. There are two ways of doing this:
    1. [Recommended] Specify the exact build pack name created in above steps in Spring Cloud Services tile.
      • Login to Ops Manager GUI using admin user
      • Click on Spring Cloud Services tile
      • Go to Spring Cloud Services tab
      • Enter the exact name of the java build pack in Buildpack textbox. In this example, it would be java-buildpack_offline_new
      • Click Save
      • Go back to Installation Dashboard and click Apply changes
    2. As a quick workaround, we can run the Spring Cloud Services Errands deploy-service-broker and register-service-broker. This will pick up the topmost java build pack from the list. This can break in a future installation if a lower version of java build pack is moved to the top of the list.
      • Login to Ops Manager using ubuntu user
      • Target the Director using the command: bosh target [<optional flags>] <Director_IP>
      • Select the Spring Cloud Services deployment: bosh deployment /var/tempest/workspaces/default/deployments/p-spring-cloud-services-<Deployment_ID>.yml
      • Run: bosh run errand deploy-service-broker
      • Once the above errand completes successfully, run: bosh run errand register-service-broker
      • Once both the errands are completed successfully, check the spring-cloud-broker app status:
        • cf target -o system -s p-spring-cloud-services
        • cf apps
      • Getting apps in org system / space p-spring-cloud-services as admin...
        OK

        name requested state instances memory disk urls
        spring-cloud-broker started 1/1 1G 1G spring-cloud-broker.xxxx.pivotal.io
        spring-cloud-broker-worker started 1/1 1G 1G spring-cloud-broker-worker.xxxx.pivotal.io
  • A good example:
    • cf create-service p-service-registry standard service-registry-1
      Creating service instance service-registry-1 in org dave / space dev as admin...
      OK
      Create in progress. Use 'cf services' or 'cf service service-registry-1' to check operation status.
    • The creation of service takes few minutes to complete:
    • cf services
      Getting services in org dave / space dev as admin...
      OK
      name service plan bound apps last operation
      service-registry-1 p-service-registry standard create succeeded

 

Comments

Powered by Zendesk