代码之家  ›  专栏  ›  技术社区  ›  Mike

如何使用jhipster调试Heroku中的应用程序,该应用程序响应:“无法处理您的请求”?

  •  0
  • Mike  · 技术社区  · 6 年前

    我在Heroku部署Jhipster时有个问题。我用jhipster创建了一个新的项目,它在本地主机上运行良好:

    ? Which *type* of application would you like to create? Monolithic application (recommended for simple projects)
    
    ? What is the base name of your application? herokutest2
    
    ? What is your default Java package name? heroku
    
    ? Do you want to use the JHipster Registry to configure, monitor and scale your application? No
    
    ? Which *type* of authentication would you like to use? HTTP Session Authentication (stateful, default Spring Security mechanism)
    
    ? Which *type* of database would you like to use? SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL)
    
    ? Which *production* database would you like to use? PostgreSQL
    
    ? Which *development* database would you like to use? H2 with in-memory persistence
    
    ? Do you want to use the Spring cache abstraction? Yes, with the Ehcache implementation (local cache, for a single node)
    
    ? Do you want to use Hibernate 2nd level cache? Yes
    
    ? Would you like to use Maven or Gradle for building the backend? Gradle
    
    ? Which other technologies would you like to use?
    
    ? Which *Framework* would you like to use for the client? Angular 5
    
    ? Would you like to enable *SASS* support using the LibSass stylesheet preprocessor? No
    
    ? Would you like to enable internationalization support? No
    
    ? Besides JUnit and Karma, which testing frameworks would you like to use?
    
    ? Would you like to install other generators from the JHipster Marketplace? No
    

    所以我有一个运行良好的应用程序。然后我在Heroku中部署了这个应用程序,而没有对原来的Jhipster项目做任何更改。

    我使用git(在heroku中编译)登录并运行jhipster heroku,在美国部署,因此最后我打开heroku,home url显示以下错误。

    Your request cannot be processed
    Sorry, an error has occurred.
    
    Status: Not Found (Not Found)
    Message: No message available
    

    日志上写着:

    module: @oclif/config@1.6.18
    task: runHook prerun
    plugin: heroku
    root: C:\Program Files\heroku\client
    2018-05-23T08:54:09.105823+00:00 app[api]: Release v1 created by user ecorreos@hotmail.com
    2018-05-23T08:54:09.105823+00:00 app[api]: Initial release by user ecorreos@hotmail.com
    2018-05-23T08:54:09.419215+00:00 app[api]: Release v2 created by user ecorreos@hotmail.com
    2018-05-23T08:54:09.419215+00:00 app[api]: Enable Logplex by user ecorreos@hotmail.com
    2018-05-23T08:54:11.830176+00:00 app[api]: Release v3 created by user ecorreos@hotmail.com
    2018-05-23T08:54:11.830176+00:00 app[api]: Attach DATABASE (@ref:postgresql-globular-46720) by user ecorreos@hotmail.com
    2018-05-23T08:54:23.966535+00:00 app[api]: Release v4 created by user ecorreos@hotmail.com
    2018-05-23T08:54:23.966535+00:00 app[api]: Set NPM_CONFIG_PRODUCTION config vars by user ecorreos@hotmail.com
    2018-05-23T08:54:37.000000+00:00 app[api]: Build started by user ecorreos@hotmail.com
    2018-05-23T08:57:51.024261+00:00 app[api]: Release v5 created by user ecorreos@hotmail.com
    2018-05-23T08:57:51.024261+00:00 app[api]: Deploy ff0268cc by user ecorreos@hotmail.com
    2018-05-23T08:57:51.038692+00:00 app[api]: Scaled to web@1:Free by user ecorreos@hotmail.com
    2018-05-23T08:57:51.000000+00:00 app[api]: Build succeeded
    2018-05-23T08:57:56.986887+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -Xmx256m -jar build/libs/*.war --spring.profiles.active=prod,heroku --server.port=39350`
    2018-05-23T08:57:58.659062+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
    2018-05-23T08:57:58.662162+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -Dfile.encoding=UTF-8
    2018-05-23T08:58:00.746362+00:00 app[web.1]:
    2018-05-23T08:58:00.746408+00:00 app[web.1]: ██╗ ██╗   ██╗ ████████��� ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
    2018-05-23T08:58:00.746410+00:00 app[web.1]: ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
    2018-05-23T08:58:00.746414+00:00 app[web.1]: ██╗   ██║ ██╔═══██║    ██║    ██╔════╝   ╚═══██╗    ██║    ██╔═══╝   ██╔══██║
    2018-05-23T08:58:00.746412+00:00 app[web.1]: ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝
    2018-05-23T08:58:00.746418+00:00 app[web.1]: ╚═════╝  ╚═╝   ╚═╝ ╚═══════╝ ╚═╝       ╚═════╝     ╚═╝    ╚═══════╝ ╚═╝   ╚═╝
    2018-05-23T08:58:00.746420+00:00 app[web.1]:
    2018-05-23T08:58:00.746416+00:00 app[web.1]: ╚██████╔╝ ██║   ██║ ████████�� ██║       ██████╔╝    ██║    ████████╗ ██║  ╚██╗
    2018-05-23T08:58:00.746422+00:00 app[web.1]: :: JHipster 🤓  :: Running Spring Boot 1.5.12.RELEASE ::
    2018-05-23T08:58:00.746424+00:00 app[web.1]: :: http://www.jhipster.tech ::
    2018-05-23T08:58:00.746435+00:00 app[web.1]:
    2018-05-23T08:58:00.982003+00:00 app[web.1]: 2018-05-23 08:58:00.975  INFO 4 --- [           main] heroku.Herokutest2App                    : Starting Herokutest2App on 51c5056d-8cde-42cf-a075-924e1c710e21 with PID 4 (/app/build/libs/herokutest-2-0.0.1-SNAPSHOT.war started by u45925 in /app)2018-05-23T08:58:00.982623+00:00 app[web.1]: 2018-05-23 08:58:00.982  INFO 4 --- [           main] heroku.Herokutest2App                    : The following profiles are active: prod,heroku
    2018-05-23T08:58:06.548212+00:00 app[web.1]: 2018-05-23 08:58:06.546  INFO 4 --- [           main] heroku.config.WebConfigurer              : Web application configuration, using profiles: prod
    2018-05-23T08:58:06.557755+00:00 app[web.1]: 2018-05-23 08:58:06.557  INFO 4 --- [           main] heroku.config.WebConfigurer              : Web application fully configured
    2018-05-23T08:58:08.442500+00:00 app[web.1]: 2018-05-23 08:58:08.442  WARN 4 --- [st-2-Executor-1] i.g.j.c.liquibase.AsyncSpringLiquibase   : Starting Liquibase asynchronously, your database might not be ready at startup!
    2018-05-23T08:58:21.497048+00:00 app[web.1]: 2018-05-23 08:58:21.496  INFO 4 --- [           main] heroku.Herokutest2App                    : Started Herokutest2App in 21.894 seconds (JVM running for 22.834)
    2018-05-23T08:58:21.497770+00:00 app[web.1]: 2018-05-23 08:58:21.497  INFO 4 --- [           main] heroku.Herokutest2App                    :
    2018-05-23T08:58:21.497774+00:00 app[web.1]: ----------------------------------------------------------
    2018-05-23T08:58:21.497776+00:00 app[web.1]: Application 'herokutest2' is running! Access URLs:
    2018-05-23T08:58:21.497778+00:00 app[web.1]: Local:             http://localhost:39350
    2018-05-23T08:58:21.497780+00:00 app[web.1]: External:  http://172.18.158.210:39350
    2018-05-23T08:58:21.497783+00:00 app[web.1]: Profile(s):        [prod, heroku]
    2018-05-23T08:58:21.497785+00:00 app[web.1]: ----------------------------------------------------------
    2018-05-23T08:58:22.237880+00:00 heroku[web.1]: State changed from starting to up
    2018-05-23T08:59:16.114847+00:00 heroku[router]: at=info method=GET path="/" host=herokutest-2.herokuapp.com request_id=b7c438e8-75d8-486b-9e8b-2bfeb33f5c93 fwd="95.18.239.39" dyno=web.1 connect=1ms service=616ms status=404 bytes=1813 protocol=https
    2018-05-23T08:59:16.949795+00:00 heroku[router]: at=info method=GET path="/$%7BbaseUrl%7D/favicon.ico" host=herokutest-2.herokuapp.com request_id=dea0cb4b-9fb9-4885-9b79-569e9f24bd07 fwd="95.18.239.39" dyno=web.1 connect=1ms service=90ms status=404 bytes=571 protocol=https
    

    警察:我把我的信用卡号码给了希罗库;-d

    按照乔恩的指示,我尝试过:

    D:\BasuraTemporal\Borrar\BOOTSRAP\JHispter\herokugradleraro1>heroku config:set GRADLE_TASK="stage -Pprod" --app=herokugradleraro1
    Setting GRADLE_TASK and restarting ⬢ herokugradleraro1... -
    (node:15420) SyntaxError Plugin: heroku: C:\Users\usuario\AppData\Local\heroku\config.json: Unexpected string in JSON at position 72
    module: @oclif/config@1.6.18
    task: runHook prerun
    plugin: heroku
    Setting GRADLE_TASK and restarting ⬢ herokugradleraro1... !
     !    Couldn't find that app.
    
    D:\BasuraTemporal\Borrar\BOOTSRAP\JHispter\herokugradleraro1>heroku config:set GRADLE_TASK="stage -Pprod" --app herokugradleraro1
    Setting GRADLE_TASK and restarting ⬢ herokugradleraro1... -
    (node:4544) SyntaxError Plugin: heroku: C:\Users\usuario\AppData\Local\heroku\config.json: Unexpected string in JSON at position 72
    module: @oclif/config@1.6.18
    task: runHook prerun
    plugin: heroku
    Setting GRADLE_TASK and restarting ⬢ herokugradleraro1... !
     !    Couldn't find that app.
    

    但它不起作用。我想我会等第五版。

    1 回复  |  直到 6 年前
        1
  •  1
  •   Jon Ruddell    6 年前

    解决这个问题的方法是为项目设置一个配置变量。您可以通过Heroku仪表板或Heroku CLI执行此操作:

    heroku config:set GRADLE_TASK="stage -Pprod" --app your-app-name-here
    

    在v5.0.0-beta.2及更高版本中不需要此修复,修复者为 this pull request .