cloudfoundry / java-buildpack

Cloud Foundry buildpack for running Java applications
Apache License 2.0
439 stars 2.58k forks source link

NoMethodError: undefined method `key?' for nil:NilClass #341

Closed hugh84 closed 8 years ago

hugh84 commented 8 years ago

I am doing a simple service-bind test and report this error。but it is work fine on my local machine。

[cf@host-cf springmysql]$ cf push -f springmysql.yml
Using manifest file springmysql.yml

Creating app springmysql in org sitech / space test as admin...
OK

Using route springmysql.bosh-lite.com
Binding springmysql.bosh-lite.com to springmysql...
OK

Uploading springmysql...
Uploading app files from: /tmp/unzipped-app201822465
Uploading 107.3K, 30 files
Done uploading

OK
Binding service mysql1 to app springmysql in org sitech / space test as admin...
OK

Starting app springmysql in org sitech / space test as admin...
Downloading java_buildpack...
Downloaded java_buildpack
Creating container
Successfully created container
Downloading app package...
Downloaded app package (5.4M)
Staging...
[Buildpack] ERROR Compile failed with exception #
undefined method `key?' for nil:NilClass
Failed to compile droplet
Exit status 223
Staging failed: Exited with status 223
Destroying container
Successfully destroyed container

FAILED
Error restarting application: BuildpackCompileFailed

TIP: use 'cf logs springmysql --recent' for more information
nebhale commented 8 years ago

Can you please cf set-env <APP> JBP_LOG_LEVEL DEBUG and restage the application? That will give us more information about exactly where the failure is happening in the buildpack.

hugh84 commented 8 years ago

@nebhale I did the operation what you said, and get debug info as follows, thanks.

[cf@host-cf springmysql]$ cf push -f springmysql.yml
Using manifest file springmysql.yml

Updating app springmysql in org sitech / space test as admin...
OK

Using route springmysql.bosh-lite.com
Uploading springmysql...
Uploading app files from: /tmp/unzipped-app821019928
Uploading 107.3K, 30 files
Done uploading               
OK
Binding service mysql1 to app springmysql in org sitech / space test as admin...
OK

Starting app springmysql in org sitech / space test as admin...
Downloading java_buildpack...
Downloaded java_buildpack
Creating container
Successfully created container
Downloading app package...
Downloaded app package (5.4M)
Staging...
[ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/config/version.yml: {"hash"=>"b050954", "remote"=>"https://github.com/cloudfoundry/java-buildpack.git", "version"=>"v3.9"}
[BuildpackVersion]               DEBUG v3.9 | https://github.com/cloudfoundry/java-buildpack.git#b050954
[Buildpack]                      DEBUG Environment Variables: {"CF_INSTANCE_ADDR"=>"", "CF_INSTANCE_IP"=>"10.244.16.10", "CF_INSTANCE_PORT"=>"", "CF_INSTANCE_PORTS"=>"[]", "CF_STACK"=>"cflinuxfs2", "HOME"=>"/home/vcap", "JBP_LOG_LEVEL"=>"DEBUG", "LANG"=>"en_US.UTF-8", "MEMORY_LIMIT"=>"1024m", "PATH"=>"/usr/local/bin:/usr/bin:/bin", "USER"=>"vcap", "VCAP_APPLICATION"=>"{\"limits\":{\"fds\":16384,\"mem\":1024,\"disk\":4096},\"application_name\":\"springmysql\",\"application_uris\":[\"springmysql.bosh-lite.com\"],\"name\":\"springmysql\",\"space_name\":\"test\",\"space_id\":\"607566a8-bc68-48cd-b1fe-515566bf549d\",\"uris\":[\"springmysql.bosh-lite.com\"],\"users\":null,\"application_id\":\"40009a87-1c67-4ca7-9f93-a760f3b23741\",\"version\":\"202c06f5-2867-48c9-b6a1-9a3f61655666\",\"application_version\":\"202c06f5-2867-48c9-b6a1-9a3f61655666\"}", "VCAP_SERVICES"=>"{\"p-mysql\":[{\n  \"credentials\": null,\n  \"syslog_drain_url\": null,\n  \"volume_mounts\": [\n\n  ],\n  \"label\": \"p-mysql\",\n  \"provider\": null,\n  \"plan\": \"smallplan\",\n  \"name\": \"mysql1\",\n  \"tags\": [\n    \"mysql\",\n    \"relational\"\n  ]\n}]}"}
[Buildpack]                      DEBUG Application Contents: [".", "META-INF", "META-INF/MANIFEST.MF", "META-INF/maven", "META-INF/maven/org.cloudfoundry.samples", "META-INF/maven/org.cloudfoundry.samples/springmysql", "META-INF/maven/org.cloudfoundry.samples/springmysql/pom.properties", "META-INF/maven/org.cloudfoundry.samples/springmysql/pom.xml", "WEB-INF", "WEB-INF/classes", "WEB-INF/classes/db-schema.sql", "WEB-INF/classes/log4j.xml", "WEB-INF/classes/org", "WEB-INF/classes/org/cloudfoundry", "WEB-INF/classes/org/cloudfoundry/samples", "WEB-INF/classes/org/cloudfoundry/samples/HomeController.class", "WEB-INF/classes/org/cloudfoundry/samples/ReferenceDataRepository$1.class", "WEB-INF/classes/org/cloudfoundry/samples/ReferenceDataRepository.class", "WEB-INF/classes/org/cloudfoundry/samples/State.class", "WEB-INF/lib", "WEB-INF/lib/aopalliance-1.0.jar", "WEB-INF/lib/commons-dbcp-1.3.jar", "WEB-INF/lib/commons-pool-1.5.4.jar", "WEB-INF/lib/javax.inject-1.jar", "WEB-INF/lib/jcl-over-slf4j-1.6.1.jar", "WEB-INF/lib/jstl-1.2.jar", "WEB-INF/lib/log4j-1.2.16.jar", "WEB-INF/lib/mysql-connector-java-5.1.15.jar", "WEB-INF/lib/slf4j-api-1.6.1.jar", "WEB-INF/lib/slf4j-log4j12-1.6.1.jar", "WEB-INF/lib/spring-aop-3.1.1.RELEASE.jar", "WEB-INF/lib/spring-asm-3.1.1.RELEASE.jar", "WEB-INF/lib/spring-beans-3.1.1.RELEASE.jar", "WEB-INF/lib/spring-context-3.1.1.RELEASE.jar", "WEB-INF/lib/spring-context-support-3.1.1.RELEASE.jar", "WEB-INF/lib/spring-core-3.1.1.RELEASE.jar", "WEB-INF/lib/spring-expression-3.1.1.RELEASE.jar", "WEB-INF/lib/spring-jdbc-3.1.1.RELEASE.jar", "WEB-INF/lib/spring-tx-3.1.1.RELEASE.jar", "WEB-INF/lib/spring-web-3.1.1.RELEASE.jar", "WEB-INF/lib/spring-webmvc-3.1.1.RELEASE.jar", "WEB-INF/root-context.xml", "WEB-INF/servlet-context.xml", "WEB-INF/views", "WEB-INF/views/home.jsp", "WEB-INF/web.xml"]
[ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/config/components.yml: {"containers"=>["JavaBuildpack::Container::DistZip", "JavaBuildpack::Container::Groovy", "JavaBuildpack::Container::JavaMain", "JavaBuildpack::Container::PlayFramework", "JavaBuildpack::Container::Ratpack", "JavaBuildpack::Container::SpringBoot", "JavaBuildpack::Container::SpringBootCLI", "JavaBuildpack::Container::Tomcat"], "jres"=>["JavaBuildpack::Jre::OpenJdkJRE"], "frameworks"=>["JavaBuildpack::Framework::AppDynamicsAgent", "JavaBuildpack::Framework::ContainerCertificateTrustStore", "JavaBuildpack::Framework::ContainerCustomizer", "JavaBuildpack::Framework::Debug", "JavaBuildpack::Framework::DynaTraceAgent", "JavaBuildpack::Framework::Jmx", "JavaBuildpack::Framework::JrebelAgent", "JavaBuildpack::Framework::LunaSecurityProvider", "JavaBuildpack::Framework::MariaDbJDBC", "JavaBuildpack::Framework::NewRelicAgent", "JavaBuildpack::Framework::PlayFrameworkAutoReconfiguration", "JavaBuildpack::Framework::PlayFrameworkJPAPlugin", "JavaBuildpack::Framework::PostgresqlJDBC", "JavaBuildpack::Framework::RuxitAgent", "JavaBuildpack::Framework::SpringAutoReconfiguration", "JavaBuildpack::Framework::SpringInsight", "JavaBuildpack::Framework::YourKitProfiler", "JavaBuildpack::Framework::JavaOpts"]}
[Buildpack]                      DEBUG Instantiating JavaBuildpack::Jre::OpenJdkJRE
[Buildpack]                      DEBUG Successfully required JavaBuildpack::Jre::OpenJdkJRE
[ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/config/open_jdk_jre.yml: {"jre"=>{"version"=>"1.8.0_10+", "repository_root"=>"{default.repository.root}/openjdk/{platform}/{architecture}"}, "memory_calculator"=>{"version"=>"2.+", "repository_root"=>"{default.repository.root}/memory-calculator/{platform}/{architecture}", "stack_threads"=>300, "memory_sizes"=>{"heap"=>nil, "metaspace"=>"64m..", "native"=>nil, "permgen"=>"64m..", "stack"=>"228k.."}, "memory_heuristics"=>{"heap"=>65, "metaspace"=>10, "native"=>15, "permgen"=>10, "stack"=>10}, "memory_initials"=>{"heap"=>"100%", "metaspace"=>"100%", "permgen"=>"100%"}}}
[ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/config/repository.yml: {"default_repository_root"=>"https://java-buildpack.cloudfoundry.org"}
[RepositoryIndex]                DEBUG {default.repository.root}/memory-calculator/{platform}/{architecture} expanded to https://java-buildpack.cloudfoundry.org/memory-calculator/trusty/x86_64
[ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/config/cache.yml: {"remote_downloads"=>"enabled", "client_authentication"=>{"certificate_location"=>nil, "private_key_location"=>nil, "private_key_password"=>nil}}
[DownloadCache]                  DEBUG Proxy: , , , 
[DownloadCache]                  DEBUG Adding HTTP options for secure connection
[ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/config/cache.yml: {"remote_downloads"=>"enabled", "client_authentication"=>{"certificate_location"=>nil, "private_key_location"=>nil, "private_key_password"=>nil}}
[DownloadCache]                  DEBUG Adding HTTP options for secure connection
[ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/config/cache.yml: {"remote_downloads"=>"enabled", "client_authentication"=>{"certificate_location"=>nil, "private_key_location"=>nil, "private_key_password"=>nil}}
[DownloadCache]                  DEBUG HTTP: java-buildpack.cloudfoundry.org, 443, {:use_ssl=>true}
[DownloadCache]                  DEBUG SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES128-GCM-SHA256
    Session-ID: 0E3AE366D5EAB0FE7B751C822957239048D75A2DE049D3B74F7AF67317A3F1C5
    Session-ID-ctx: 
    Master-Key: 630C62BF09162BBEED25F183C1994E23BD43E4102F9D5760C3AA311407BCF57D2A97FF715133D464A53161CEC2FEC633
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    TLS session ticket lifetime hint: 10800 (seconds)
    TLS session ticket:
    0000 - 21 6a 84 07 53 65 48 90-c0 7b 86 d2 9e ff 80 c3   !j..SeH..{......
    0010 - 7c 81 85 53 90 2d e7 48-15 26 03 f5 16 6f 5a fa   |..S.-.H.&...oZ.
    0020 - 8f bc 27 2b d4 95 05 4c-fd be 7b 23 ae 90 38 f3   ..'+...L..{#..8.
    0030 - ab 8e 4e c2 cb 7e 63 d8-42 2a 04 3e a2 b1 70 d8   ..N..~c.B*.>..p.
    0040 - 45 4f e2 17 5f 59 f3 61-88 d5 45 7f 1c a8 05 e5   EO.._Y.a..E.....
    0050 - 5f a1 6f dd 1e de 37 72-bf 3a 3d b0 bb 00 f7 09   _.o...7r.:=.....
    0060 - a6 c9 60 f3 e4 99 f5 c2-fe 35 31 3a 4c b8 bf 48   ..`......51:L..H
    0070 - cc 84 7c cd e2 44 f5 8f-48 49 fe d1 78 df 85 d8   ..|..D..HI..x...
    0080 - 60 9e 7c cb 16 7e ee 10-07 fd 60 02 3f 2d 89 36   `.|..~....`.?-.6
    0090 - 21 18 24 0a 23 ba 51 28-d4 30 55 b8 0c 8a 7c f2   !.$.#.Q(.0U...|.
    00a0 - d1 f4 5f 61 90 dd cc d8-b8 82 73 0a ea 8c 42 d5   .._a......s...B.
    00b0 - 75 a3 18 37 95 32 16 31-2e 82 c0 e7 b7 a4 18 84   u..7.2.1........
    Start Time: 1476926515
    Timeout   : 300 (sec)
    Verify return code: 0 (ok)
[DownloadCache]                  DEBUG Request: /memory-calculator/trusty/x86_64/index.yml, {"accept-encoding"=>["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"], "accept"=>["*/*"], "user-agent"=>["Ruby"]}
[DownloadCache]                  DEBUG Response headers: {"content-type"=>["text/x-yaml"], "content-length"=>["739"], "connection"=>["keep-alive"], "date"=>["Tue, 04 Oct 2016 08:44:33 GMT"], "last-modified"=>["Tue, 30 Aug 2016 13:52:01 GMT"], "etag"=>["\"84c4af1a56708f9504cc7fec7946afd3\""], "x-amz-version-id"=>["Ky10baz5T2KAMZfqH3Fr0A0GGOih34VJ"], "accept-ranges"=>["bytes"], "server"=>["AmazonS3"], "x-cache"=>["RefreshHit from cloudfront"], "via"=>["1.1 0d71ec999d11c7cacbc516a59a07cfc5.cloudfront.net (CloudFront)"], "x-amz-cf-id"=>["9XV46GUY4aOrHS5BbYa0aWKOjscpKSBJ4Hb87bXJ6ERvwSK9uwqqAA=="]}
[DownloadCache]                  DEBUG Response status: 200
[DownloadCache]                  DEBUG Persisting etag: "84c4af1a56708f9504cc7fec7946afd3"
[DownloadCache]                  DEBUG Persisting last-modified: Tue, 30 Aug 2016 13:52:01 GMT
[DownloadCache]                  DEBUG Persisting content to /tmp/https%3A%2F%2Fjava-buildpack.cloudfoundry.org%2Fmemory-calculator%2Ftrusty%2Fx86_64%2Findex.yml.cached
[DownloadCache]                  DEBUG Validated content size 739 is 739
[RepositoryIndex]                DEBUG {"1.0.0_RELEASE"=>"https://java-buildpack.cloudfoundry.org/memory-calculator/trusty/x86_64/memory-calculator-1.0.0_RELEASE", "1.1.0_RELEASE"=>"https://java-buildpack.cloudfoundry.org/memory-calculator/trusty/x86_64/memory-calculator-1.1.0_RELEASE", "1.1.1_RELEASE"=>"https://java-buildpack.cloudfoundry.org/memory-calculator/trusty/x86_64/memory-calculator-1.1.1_RELEASE", "2.0.0_RELEASE"=>"https://java-buildpack.cloudfoundry.org/memory-calculator/trusty/x86_64/memory-calculator-2.0.0_RELEASE.tar.gz", "2.0.1_RELEASE"=>"https://java-buildpack.cloudfoundry.org/memory-calculator/trusty/x86_64/memory-calculator-2.0.1_RELEASE.tar.gz", "2.0.2_RELEASE"=>"https://java-buildpack.cloudfoundry.org/memory-calculator/trusty/x86_64/memory-calculator-2.0.2_RELEASE.tar.gz"}
[Buildpack]                      DEBUG Instantiating JavaBuildpack::Framework::AppDynamicsAgent
[Buildpack]                      DEBUG Successfully required JavaBuildpack::Framework::AppDynamicsAgent
[ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/config/app_dynamics_agent.yml: {"version"=>"4.+", "repository_root"=>"{default.repository.root}/app-dynamics", "default_application_name"=>nil, "default_node_name"=>"$(ruby -e \"require 'json' ; a = JSON.parse(ENV['VCAP_APPLICATION']); puts \\\"\#{a['application_name']}:\#{a['instance_index']}\\\"\")", "default_tier_name"=>nil}
[Buildpack]                      DEBUG Instantiating JavaBuildpack::Framework::ContainerCertificateTrustStore
[Buildpack]                      DEBUG Successfully required JavaBuildpack::Framework::ContainerCertificateTrustStore
[ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/config/container_certificate_trust_store.yml: {"enabled"=>false}
[Buildpack]                      DEBUG Instantiating JavaBuildpack::Framework::ContainerCustomizer
[Buildpack]                      DEBUG Successfully required JavaBuildpack::Framework::ContainerCustomizer
[ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/config/container_customizer.yml: {"version"=>"1.+", "repository_root"=>"{default.repository.root}/container-customizer"}
[Buildpack]                      DEBUG Instantiating JavaBuildpack::Framework::Debug
[Buildpack]                      DEBUG Successfully required JavaBuildpack::Framework::Debug
[ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/config/debug.yml: {"enabled"=>false, "port"=>8000, "suspend"=>false}
[Buildpack]                      DEBUG Instantiating JavaBuildpack::Framework::DynaTraceAgent
[Buildpack]                      DEBUG Successfully required JavaBuildpack::Framework::DynaTraceAgent
[ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/config/dyna_trace_agent.yml: {"version"=>"6.3.0_+", "repository_root"=>"http://downloads.dynatracesaas.com/cloudfoundry/buildpack/java", "default_agent_name"=>nil}
[Buildpack]                      DEBUG Instantiating JavaBuildpack::Framework::Jmx
[Buildpack]                      DEBUG Successfully required JavaBuildpack::Framework::Jmx
[ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/config/jmx.yml: {"enabled"=>false, "port"=>5000}
[Buildpack]                      DEBUG Instantiating JavaBuildpack::Framework::JrebelAgent
[Buildpack]                      DEBUG Successfully required JavaBuildpack::Framework::JrebelAgent
[ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/config/jrebel_agent.yml: {"version"=>"6.+", "repository_root"=>"https://dl.zeroturnaround.com/jrebel"}
[Buildpack]                      DEBUG Instantiating JavaBuildpack::Framework::LunaSecurityProvider
[Buildpack]                      DEBUG Successfully required JavaBuildpack::Framework::LunaSecurityProvider
[ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/config/luna_security_provider.yml: {"version"=>"6.+", "repository_root"=>"http://files.cf-hsm.io/luna-installer", "logging_enabled"=>false}
[Buildpack]                      DEBUG Instantiating JavaBuildpack::Framework::MariaDbJDBC
[Buildpack]                      DEBUG Successfully required JavaBuildpack::Framework::MariaDbJDBC
[ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/config/maria_db_jdbc.yml: {"version"=>"1.+", "repository_root"=>"{default.repository.root}/mariadb-jdbc"}
[Buildpack]                      ERROR Compile failed with exception #<NoMethodError: undefined method `key?' for nil:NilClass>
[Buildpack]                      DEBUG Exception #<NoMethodError: undefined method `key?' for nil:NilClass> backtrace:
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/component/services.rb:72:in `block in credentials?'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/component/services.rb:71:in `each'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/component/services.rb:71:in `all?'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/component/services.rb:71:in `credentials?'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/component/services.rb:45:in `one_service?'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/framework/maria_db_jdbc.rb:54:in `block in service?'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/framework/maria_db_jdbc.rb:54:in `any?'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/framework/maria_db_jdbc.rb:54:in `service?'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/framework/maria_db_jdbc.rb:42:in `supports?'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/component/versioned_dependency_component.rb:39:in `initialize'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/buildpack.rb:168:in `new'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/buildpack.rb:168:in `block in instantiate'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/buildpack.rb:154:in `map'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/buildpack.rb:154:in `instantiate'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/buildpack.rb:127:in `instantiate_components'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/buildpack.rb:120:in `initialize'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/buildpack.rb:225:in `new'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/lib/java_buildpack/buildpack.rb:225:in `with_buildpack'
/tmp/buildpacks/bba17ab3a449be3dd82ba90e8ebcd92a/bin/compile:26:in `<main>'
undefined method `key?' for nil:NilClass
Failed to compile droplet
Exit status 223
Staging failed: Exited with status 223
Destroying container
Successfully destroyed container

FAILED
Error restarting application: BuildpackCompileFailed

TIP: use 'cf logs springmysql --recent' for more information
nebhale commented 8 years ago

The problem is that you have an illegal value for VCAP_SERVICES:

{
  "p-mysql": [
    {
      "credentials": null,
      "syslog_drain_url": null,
      "volume_mounts": [],
      "label": "p-mysql",
      "provider": null,
      "plan": "smallplan",
      "name": "mysql1",
      "tags": [
        "mysql",
        "relational"
      ]
    }
  ]
}

Note the null value for credentials. The contract of these values is that they can be empty, but never null. As you can see from the simplest possible service (cf create-user-provided-service foo) even if there are no credentials you get an empty JSON hash as a value.

{
  "user-provided": [
    {
      "credentials": {},
      "label": "user-provided",
      "name": "foo",
      "syslog_drain_url": "",
      "tags": [],
      "volume_mounts": []
    }
  ]
}

We'll add a better error message but when presented with null the buildpack is always going to fail in this way.

hugh84 commented 8 years ago

I am sorry about reopened. because I tried a variety of methods, but the value of credentials is still null. I read the document and searched on the internet, and I found public opinions are divergent. so I am confused. I want know that who generate the value of credentials, cloud controller? buildpack? broker? or service node? and what operation I should do now? Forgive me for beginners, thank you.

nebhale commented 8 years ago

The Service Broker returns credentials during binding. Those credentials are passed to the Cloud Controller which exposes them to the application via VCAP_SERVICES during both staging and runtime. Credentials can also be provided via User Provided Service in which case the user creates the credentials and passes that to the Cloud Controller which in turn exposes them to the application. If you're still having trouble generating the proper credentials payload, I recommend posting to the cf-dev mailing list.