我想在Heroku上啓動一個應用程序,但我面臨一個問題,我會一步一步告訴我做了什麼來達到這一點,如果有人幫助我,我會非常幫助我會發送一個巧克力蛋糕:D在Heroku中啓動應用程序(Maven)
首先我在Eclipse中創建我的maven項目,在我的localhost中,一切都正常。
所以我的代碼發送到github上: https://github.com/ViniMartinPS/olimpiadas
但是,我認爲的代碼將是非常有益的在這裏,在我的頭上,問題是CONFIGS。
我在Heroku中創建我的應用程序,並使用git代碼進行部署,沒有問題,部署OK。我還下載了2個插件:Heroku Postgree和JawsDB MySQL,但我沒有改變任何東西。我的代碼只是測試Heroku是否適合我。
所以,我認爲是一切就OK了測試,但我有錯誤訊息,當我試圖訪問該頁面:
「在應用程序中出現錯誤,你的頁面無法送達請再試一次
如果您是應用程序所有者,請查看您的日誌以瞭解詳細信息。「
而且我有一個在日誌中:
2016-08-23T19:00:49.102379+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/games/webapi/jogos/esporte1" host=thawing-temple-28369.herokuapp.com request_id=f5edce97-25b5-4b6a-8139-47c6083260c9 fwd="179.132.109.129" dyno= connect= service= status=503 bytes=
2016-08-23T19:00:49.588961+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=thawing-temple-28369.herokuapp.com request_id=f0c3ff79-2d70-4fa7-ad0a-b810ec9a6d38 fwd="179.132.109.129" dyno= connect= service= status=503 bytes=
於是我研究,看看有關DYNOS/Procfiles,我試圖創建一個並粘貼到Heroku上:
web: java $JAVA_OPTS -cp target/classes:target/olimpiadas/games/MyResource
MyResource是一類例如,我在我的項目中。
然後我重新啓動DYNOS:
2016-08-23T19:03:10.002566+00:00 heroku[web.1]: State changed from crashed to starting
2016-08-23T19:03:12.998462+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -cp target/classes:target/olimpiadas/games/MyResource`
2016-08-23T19:03:15.501843+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2016-08-23T19:03:15.506279+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx350m -Xss512k -Dfile.encoding=UTF-8
2016-08-23T19:03:15.728591+00:00 app[web.1]: (to execute a jar file)
2016-08-23T19:03:15.728598+00:00 app[web.1]: -cp <class search path of directories and zip/jar files>
2016-08-23T19:03:15.728603+00:00 app[web.1]: -version print product version and exit
2016-08-23T19:03:15.728604+00:00 app[web.1]: -version:<value>
2016-08-23T19:03:15.728609+00:00 app[web.1]: in a future release.
2016-08-23T19:03:15.728613+00:00 app[web.1]: -disableassertions[:<packagename>...|:<classname>]
2016-08-23T19:03:15.728618+00:00 app[web.1]: see also, -agentlib:jdwp=help and -agentlib:hprof=help
2016-08-23T19:03:15.841736+00:00 heroku[web.1]: Process exited with status 1
2016-08-23T19:03:15.875119+00:00 heroku[web.1]: State changed from starting to crashed
2016-08-23T19:03:15.876084+00:00 heroku[web.1]: State changed from crashed to starting
2016-08-23T19:03:18.382238+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -cp target/classes:target/olimpiadas/games/MyResource`
2016-08-23T19:03:20.004342+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2016-08-23T19:03:20.009058+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx350m -Xss512k -Dfile.encoding=UTF-8
2016-08-23T19:03:20.401910+00:00 app[web.1]: Usage: java [-options] class [args...]
2016-08-23T19:03:20.401923+00:00 app[web.1]: (to execute a class)
2016-08-23T19:03:20.401924+00:00 app[web.1]: or java [-options] -jar jarfile [args...]
2016-08-23T19:03:20.401928+00:00 app[web.1]:
2016-08-23T19:03:20.401929+00:00 app[web.1]: -classpath <class search path of directories and zip/jar files>
2016-08-23T19:03:20.401930+00:00 app[web.1]: -D<name>=<value>
2016-08-23T19:03:20.401934+00:00 app[web.1]: Warning: this feature is deprecated and will be removed
2016-08-23T19:03:20.401938+00:00 app[web.1]: disable assertions with specified granularity
2016-08-23T19:03:20.401940+00:00 app[web.1]: load native agent library <libname>, e.g. -agentlib:hprof
2016-08-23T19:03:20.401947+00:00 app[web.1]: See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
2016-08-23T19:03:20.459704+00:00 heroku[web.1]: Process exited with status 1
2016-08-23T19:03:20.459575+00:00 heroku[web.1]: State changed from starting to crashed
我有同樣的錯誤,如果我嘗試再次使用的頁面。可能這個Procfile是錯誤的,或者我需要添加一些關於數據庫的東西,我不知道。
有人可以幫助我嗎?我真的需要部署的應用程序,我會很開心:)
謝謝你這麼多
你使用Git或Maven插件部署?你的'Procfile'是否被提交給Git(運行'git ls-files'來確認)? – codefinger
沒關係,日誌中的'Starting process with command'確認它是 – codefinger
當你運行'heroku config:get JAVA_OPTS'時會顯示什麼? – codefinger