2016-11-03 1 views
1

내 웹 응용 프로그램 (spark java)은 로컬에서 제대로 실행되지만 Heroku에 배포되면 빈 페이지가 표시됩니다. 여기 heroku의 Java 웹 응용 프로그램 빈 페이지가 있지만 로컬로 실행됩니다.

https://fathomless-garden-15009.herokuapp.com/fathomless-garden-15009 

Web process failed to bind to $PORT within 90 seconds of launch 
2016-11-03T01:56:33.511626+00:00 heroku[web.1]: Stopping process with SIGKILL 

하지만 다른 솔루션에서

는 SO 지시에

2016-11-03T01:54:56.324006+00:00 heroku[web.1]: State changed from crashed to starting 
2016-11-03T01:55:02.989594+00:00 heroku[web.1]: Starting process with command ` java -Dserver.port=34284 -jar build/libs/freebid-0.1.0-SNAPSHOT.jar` 
2016-11-03T01:55:04.872996+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS  defaults based on dyno size. Custom settings will override them. 
2016-11-03T01:55:04.876437+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx350m -Xss512k -Dfile.encoding=UTF-8 
2016-11-03T01:55:04.970619+00:00 app[web.1]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 
2016-11-03T01:55:04.970667+00:00 app[web.1]: SLF4J: Defaulting to no-operation (NOP) logger implementation 
2016-11-03T01:55:04.970721+00:00 app[web.1]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 
2016-11-03T01:55:05.604913+00:00 app[web.1]: [INFO ] 2016-11-03 01:55:05.604 [main] BuildInfo - Git commit is null 
2016-11-03T01:55:05.604806+00:00 app[web.1]: [INFO ] 2016-11-03 01:55:05.603 [main] BuildInfo - Built on null by null 
2016-11-03T01:55:05.605942+00:00 app[web.1]: [INFO ] 2016-11-03 01:55:05.605 [main] PropertyResolver - properties file /credentials.properties is missing or invalid 
2016-11-03T01:55:05.605760+00:00 app[web.1]: [INFO ] 2016-11-03 01:55:05.605 [main] PropertyResolver - properties file /environment-ex.properties is missing or invalid 
2016-11-03T01:55:05.606112+00:00 app[web.1]: [INFO ] 2016-11-03 01:55:05.606 [main] PropertyResolver - properties file /credentials-ex.properties is missing or invalid 
2016-11-03T01:55:05.606259+00:00 app[web.1]: [INFO ] 2016-11-03 01:55:05.606 [main] PropertyResolver - resolved devMode in environment.properties as true 
2016-11-03T01:55:05.614766+00:00 app[web.1]: [INFO ] 2016-11-03 01:55:05.614 [main] PropertyResolver - resolved httpServer.port in environment.properties as 3016 
2016-11-03T01:55:05.614940+00:00 app[web.1]: [INFO ] 2016-11-03 01:55:05.614 [main] PropertyResolver - resolved template.engine in environment.properties as reloadable 
2016-11-03T01:55:05.705113+00:00 app[web.1]: [INFO ] 2016-11-03 01:55:05.704 [main] PropertyResolver - failed to resolve heap.analytics.id 
2016-11-03T01:55:05.731095+00:00 app[web.1]: [INFO ] 2016-11-03 01:55:05.730 [main] ApiController - Loading ObjectMapper 
2016-11-03T01:56:33.511375+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch 
2016-11-03T01:56:33.511626+00:00 heroku[web.1]: Stopping process with SIGKILL 
2016-11-03T01:56:33.669397+00:00 heroku[web.1]: State changed from starting to crashed 
2016-11-03T01:56:33.648115+00:00 heroku[web.1]: Process exited with status 137 

내 Procfile

web: java -Dserver.port=$PORT -jar build/libs/freebid-0.1.0-SNAPSHOT.jar 

는 로그에서이 범인처럼 찾고 로그입니다 나는 다음을 추가해야한다. 내가 한 procfile에 낮은;

-Dserver.port=$PORT 

이것이 유일한 문제인지는 확실하지 않지만 시작일 수 있습니다.

정말 스파크 기리는 -Dserver.port 옵션 경우 나도 몰라 몇 가지 포인터

답변

3

감사하겠습니다. Java 코드에서 포트를 명시 적으로 설정했습니다.

port(Integer.valueOf(System.getenv("PORT"))); 

full example on Github을 볼 수 있습니다.

heroku local web을 실행하여 로컬에서 테스트 할 수 있으며 포트 5000에 바인딩해야합니다. 그렇지 않으면 Heroku에서 작동하지 않습니다.

+0

감사합니다. 이것은 완벽하게 작동했습니다. –

관련 문제