java - 在 heroku 上部署 tomcat servlet 项目

标签 java tomcat servlets heroku webapp-runner

我开发了一个基于 tomcat-servlet 的 Web 应用程序,我可以在本地机器上很好地运行它。我通过向它发送一个 json 来发送请求:

"curl ontent-type: application/json" --request POST --data '{"username":"Piran", "password":"123", "requestedUsername":"hsn.vahedi", "requestedPassword":"111", "role":"client", "firstName":"Hossein", "lastName":"Vahedi", "phoneNumber":"09212814194"}' localhost:8080/myApp/register"

它给了我正确的 json 响应。但是当我以这种方式在 heroku 上部署我的应用程序时:https://devcenter.heroku.com/articles/java-webapp-runner并向它发送一个请求,它给了我这个响应:

<!DOCTYPE html>
    <html>
    <head>
        <title>Heroku | Welcome to your new app!</title>
        <style type='text/css'>
      body {
        background-color: white;
        color: #333333;
          font-family: Arial, sans-serif;
        margin: 0;
        padding: 36px;
        line-height: 1;
        font-size: 14px; }

      .section {
        margin-bottom: 36px; }
        .section.friendly {
          color: #222222; }
          .section.friendly h1 {
            font-size: 26px;
            background-color: #dad8e4;
            padding: 18px 22px 15px 22px;
            margin: 0;
            overflow: hidden; }
            .section.friendly h1 strong {
              display: inline-block;
              float: left; }
            .section.friendly h1 small {
              display: inline-block;
              float: right;
              text-align: right;
              font-size: 18px;
              padding-top: 4px;
              color: #333333; }
          .section.friendly .article {
            border: 4px solid #dad8e4;
            padding: 24px 18px 18px 18px; }
            .section.friendly .article h3 {
              font-size: 20px;
              margin: 0 0 18px 0; }
            .section.friendly .article a {
              color: #6b6ceb; }
              .section.friendly .article a:visited {
                color: #1d1d3b; }
            .section.friendly .article p {
              font-size: 14px; }
            .section.friendly .article ul {
              list-style-type: square; }
      .section.original {
        background-color: #eeeeee;
        color: #444444; }
        .section.original h2 {
          background-color: #dddddd;
          margin: 0;
          padding: 18px 22px 18px 22px;
          font-size: 20px; }
        .section.original pre {
          margin: 0;
          padding: 18px 22px 18px 22px;
          overflow: auto;
          font-family: monaco, monospaced; }
          .section.original pre code {
            display: block;
            font-size: 11px;
            width: 100%; }
    </style>
    </head>
    <body>
        <div class='container'>
          <div class='section friendly'>
            <h1><strong>Heroku | Welcome to your new app!</strong></h1>
            <div class='article'>
              <p>Refer to the <a href="//devcenter.heroku.com/">documentation</a> if you need help deploying.</p>
            </div>
          </div>
        </div>
    </body>
    </html>

问题是什么?谢谢!

最佳答案

关于java - 在 heroku 上部署 tomcat servlet 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37002529/

相关文章:

java - 是否可以使用变量调用方法?

java - 如何在 Tomcat maven 插件中更改 tomcat 版本?

session - 为什么 session 属性在 Servlet 中不是线程安全的?

java - 如何处理 hibernate 中的异常?

Java Applet 开始执行后停止

java - 你怎么知道可能有异常(exception)?

java - 我的 ArrayList 中的射弹在碰撞时不会单独改变,我该如何解决这个问题?

tomcat - 如何从 2 个 Tomcat 内访问同一个 JMX MBean 服务器

java - 如何在 J2EE Web 应用程序中创建类似 "http://username.example.com"的域?

java - Servlet Hello World 错误 - 根本原因 : java. lang.ClassNotFoundException: