【问题标题】:Accessing application deployed on Heroku访问部署在 Heroku 上的应用程序
【发布时间】:2015-03-29 02:55:18
【问题描述】:

我已经在 Heroku 上部署了我的应用程序,现在我无法访问该应用程序。

我的是一个 RESTful Java 应用程序,我按照以下步骤进行部署。

登录 git 克隆 http://xxxxxxxxxxxxxxxxxxxxx.git cd 项目名称 heroku 创建 git push heroku 大师 heroku deploy:war --war xxxxxxxxxxx.war --app appName

部署后,它给了我一个如下的网址:

https://some_context_name.herokuapp.com/ 部署到 Heroku

在这之后我应该做些什么吗?如果我正在寻找 /v1/xyz 的 GET 休息调用,我的 url 应该是什么?

【问题讨论】:

  • 你是否按照这个来部署你的 heroku 应用程序? “devcenter.heroku.com/articles/git”。在您的情况下,我认为您没有将您的项目配置为 maven 项目,如果您没有,您应该这样做以确保它与 Heroku 服务器稳定工作。
  • 是的,我已按照步骤操作,我看到那里部署了应用程序,但我无法发送休息请求,它就是无法识别。如果我的应用程序部署在 some.heroku.com,我如何访问我的休息电话?假设我有 /v1/x/y/ 形式的请求?
  • 你能去你的 IDE 拍一张关于项目文件夹结构的照片,然后在这里发布并分享一些关于你的 API 的代码吗?

标签: java rest heroku


【解决方案1】:

在日志中,您可以查看部署应用的 IP 地址。

heroku 日志 -n 200

它会显示你的 url 和 ip 地址.. 如下所示..

enter code her 2017-10-03T17:56:26.280776+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/hello" host=writealone-demo.herokuapp.com r

equest_id=e64e66a1-e1b2-4681-84f7-647cb28b3c28 fwd="150.242.67.234" dyno=connect= service= status=503 bytes= protocol=https`

您可以将正确的网址设为:

protocol:ipaddress/path

或协议:主机/路径

https://150.242.67.234/hellohttps:writealone-demo.herokuapp.com/hello

【讨论】:

    【解决方案2】:

    你的网址应该是https://some_context_name.herokuapp.com/v1/xyz

    这是 heroku 应用的 url,并在其中添加了您的应用的路由。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-12-10
    • 2018-11-19
    • 2021-09-23
    • 2020-09-07
    • 1970-01-01
    • 2019-08-03
    • 2011-12-05
    相关资源
    最近更新 更多