【问题标题】:Cloud Foundry unable to deploy grails app [UnknownHostException]Cloud Foundry 无法部署 grails 应用程序 [UnknownHostException]
【发布时间】:2013-11-16 04:01:06
【问题描述】:

我最近尝试在 Cloud Foundry 上部署 Grails 项目,执行“grails cf-push”时出现以下错误

Environment set to production.....
Error Error executing script_ CfPush: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://api.cloudfoundry.com/users/username@gmail.com/tokens":api.cloudfoundry.com; nested exception is java.net.UnknownHostException: api.cloudfoundry.com (Use --stacktrace to see the full trace)

对于“grails cf-push --stacktrace”:

Error Error executing script_ CfPush: org.springframework.web.client.ResourceAccessException: I/O error: api.cloudfoundry.com; nested exception is java.net.UnknownHostException: api.cloudfoundry.com (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
org.springframework.web.client.ResourceAccessException: I/O error: api.cloudfoundry.com; nested exception is java.net.UnknownHostException: api.cloudfoundry.com
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:461)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:409)
at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:287)
at org.cloudfoundry.client.lib.CloudFoundryClient.login(CloudFoundryClient.java:210)
at ClientWrapper.methodMissing(_CfCommon_groovy:536)
at _CfCommon_groovy$_run_closure5.doCall(_CfCommon_groovy:110)
at _CfCommon_groovy$_run_closure5.call(_CfCommon_groovy)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at CfPush$_run_closure1.doCall(CfPush:40)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
at java_util_concurrent_Callable$call.call(Unknown Source)
at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
at java_util_concurrent_Callable$call.call(Unknown Source)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at java_util_concurrent_Callable$call.call(Unknown Source)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:591)
at gant.Gant.executeTargets(Gant.groovy:590)
Caused by: java.net.UnknownHostException: api.cloudfoundry.com
at grails.plugin.cloudfoundry.GrailsHttpRequestFactory$1.intercept(GrailsHttpRequestFactory.java:91)
at $java.net.HttpURLConnection$$EnhancerByCGLIB$$7c6bfa30.connect(<generated>)
at grails.plugin.cloudfoundry.GrailsHttpRequest.executeInternal(GrailsHttpRequest.java:75)
at grails.plugin.cloudfoundry.GrailsHttpRequest.executeInternal(GrailsHttpRequest.java:89)
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:49)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:446)
... 30 more

几个月前一切正常,但我不得不停止该项目的工作一段时间。当我重新开始使用它时,我意识到不再可以像往常那样部署它。

我认为我需要升级我的 cloud-foundry 插件,所以在一天的工作中我升级了整个 groovy/grails 环境:

groovy 2.0.5 到 2.1.9 grails 2.1.2 到 2.3.1

使用以下说明连同项目本身: http://grails.org/doc/2.3.0.M1/guide/upgradingFromPreviousVersionsOfGrails.html

依赖关系自行解决相当顺利(以及最新的 cloud-foundry 1.2.3 插件)。但是部署仍然失败并出现同样的错误。

“vmc info”告诉我“api.cloudfoundry.com”不存在。 我出主意了。地址改了吗?是否有任何按惯例解决问题的方法,或者这里发生了什么其他事情?

【问题讨论】:

    标签: grails groovy cloud-foundry vmc


    【解决方案1】:

    “api.cloudfoundry.com”是托管的 Cloud Foundry v1 的 URL,它不再存在。 “cloudfoundry.com”已被http://run.pivotal.io取代,即Cloud Foundry v2。

    Cloud Foundry Grails 插件尚未更新以支持 CF v2。您应该使用“cf”CLI 来与 CF 交互,而不是使用 Grails 插件脚本。请参阅http://docs.cloudfoundry.com/docs/using/managing-apps/cf/index.htmlhttp://docs.cloudfoundry.com/docs/using/deploying-apps/jvm/index.html

    【讨论】:

    • 感谢您的回答。我现在正在使用 cf。准确地说:grails prod war; cf push --path target/app-name-0.1.war 工作正常。唯一的问题是它每次都部署整个应用程序和所有依赖项,这需要相当长的时间。 Cloud Foundry Grails 插件用于仅部署我自上次上传以来所做的更改。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-10
    相关资源
    最近更新 更多