grails mongodb连接拒绝 [英] grails mongodb connection refused

查看:122
本文介绍了grails mongodb连接拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的grails应用程序可以连接到我本地的mongodb并且工作正常,但是当我部署到云代工厂时,出现连接拒绝错误,试图连接到cf上的mongodb。



我将mongodb服务绑定到了我的应用程序,但它仍然无法连接?

barry-alexanders-MacBook-Pro:〜barryalexander $ vmc apps

  + ------------- + ---- + --------- + ------------------------- + ----------------- + 
|应用程序| #|健康| URLS |服务|
+ ------------- + ---- + --------- + ---------------- --------- + ----------------- +
| RelCal | 1 |运行| relcal.cloudfoundry.com | mongodb-a77900c |
|巴里| 1 |已停止| barry.cloudfoundry.com | |
+ ------------- + ---- + --------- + ---------------- --------- + ----------------- +

以下是在 http://relcal.cloudfoundry.com上点击我的应用程序后的堆栈跟踪/发布/日历

  

行|方法
- >> 228 | _open in com.mongodb.DBPort
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 112 |进入''
| 79 |打电话。 。在''
|中218 |请在com.mongodb.DBTCPConnector
|中调用305 | __找 。在com.mongodb.DBApiLayer $ MyCollection
|中369 | _check in com.mongodb.DBCursor
| 498 | '
|中的_hasNext 523 | hasNext在''
| 40 | hasNext在com.google.code.morphia.query.MorphiaIterator
|中258 | asList in com.google.code.morphia.query.QueryImpl
| 20 | doCall。 in com.gap.release.calendar.RelCalRestController $ _closure1
^ 662 |在java.lang.Thread中运行

我错过了一些东西,但不知道

解决方案

此时,在将grails / mongo应用程序部署到cloudfoundry时,最好使用 Cloud Foundry服务 - 在Grails中使用MongoDB而不是使用morphia。

My grails app can connect to my local mongodb and works fine but when I deploy to cloud foundry, I get a connection refused error trying to connect to mongodb on cf.

I bound a mongodb service to my app, but it still can't connect?

barry-alexanders-MacBook-Pro:~ barryalexander$ vmc apps

+-------------+----+---------+-------------------------+-----------------+
| Application | #  | Health  | URLS                    | Services        |
+-------------+----+---------+-------------------------+-----------------+
| RelCal      | 1  | RUNNING | relcal.cloudfoundry.com | mongodb-a77900c |
| barry       | 1  | STOPPED | barry.cloudfoundry.com  |                 |
+-------------+----+---------+-------------------------+-----------------+

Here's the stack trace after hitting my app at http://relcal.cloudfoundry.com/release/calendar



        Line | Method
    ->> 228 | _open    in com.mongodb.DBPort
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
    |   112 | go       in     ''
    |    79 | call . . in     ''
    |   218 | call     in com.mongodb.DBTCPConnector
    |   305 | __find . in com.mongodb.DBApiLayer$MyCollection
    |   369 | _check   in com.mongodb.DBCursor
    |   498 | _hasNext in     ''
    |   523 | hasNext  in     ''
    |    40 | hasNext  in com.google.code.morphia.query.MorphiaIterator
    |   258 | asList   in com.google.code.morphia.query.QueryImpl
    |    20 | doCall . in com.gap.release.calendar.RelCalRestController$_closure1
    ^   662 | run      in java.lang.Thread

I'm missing something but don't know what.

解决方案

At this time, when deploying grails/mongo apps to cloudfoundry, it's best to use the approach described at Cloud Foundry Services - Using MongoDB with Grails rather than using morphia.

这篇关于grails mongodb连接拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆