Доступ к конечной точке Heroku - SpringBootApp 503Service недоступен - PullRequest
0 голосов
/ 16 марта 2020

У меня есть приложение springBoot, развернутое в Heroku, я хотел бы сделать несколько запросов к этому приложению, но я получаю сообщение об ошибке 503.

В моем местном я использую следующий URL для выполнения запроса на получение: http://localhost: 8080 / предложения? Q = Лондо & широта = 43.70011 & долгота = -79.4163

И в Heroku я использую следующий URL: https://heroku-boot-app-chall.herokuapp.com/suggestions?q=Londo&latitude=43.70011&longitude=-79.4163. Я не совсем уверен, как можно сделать запрос на мое приложение, развернутое в Heroku, сборка прошла успешно. Я просто фиксирую свои источники в github и Heroku. Прежде чем я смогу выполнить какой-либо запрос, мне нужно сделать еще один шаг?

Это журналы:

2020-03-15T22:41:18.739435+00:00 heroku[web.1]: State changed from crashed to starting
2020-03-15T22:41:24.686661+00:00 heroku[web.1]: Starting process with command `java -Dserver.port=25003 $JAVA_OPTS -jar target/backend-coding-challenge-1.0-SNAPSHOT.jar`
2020-03-15T22:41:26.617949+00:00 heroku[web.1]: State changed from starting to crashed
2020-03-15T22:41:26.596700+00:00 heroku[web.1]: Process exited with status 1
2020-03-15T22:41:26.457261+00:00 app[web.1]: Create a Procfile to customize the command used to run this process: https://devcenter.heroku.com/articles/procfile
2020-03-15T22:41:26.469191+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2020-03-15T22:41:26.472555+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8 
2020-03-15T22:41:26.557238+00:00 app[web.1]: no main manifest attribute, in target/backend-coding-challenge-1.0-SNAPSHOT.jar
2020-03-15T22:46:51.520471+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/robots.txt" host=heroku-boot-app-chall.herokuapp.com request_id=5d91aac3-05d9-4075-83ce-1eea931f5a32 fwd="94.130.167.85" dyno= connect= service= status=503 bytes= protocol=https
2020-03-15T22:46:52.053784+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/suggestions?q=Londo&latitude=43.70011&longitude=-79.4163" host=heroku-boot-app-chall.herokuapp.com request_id=b9ba4950-1f83-4959-bc79-901a96d5fd02 fwd="94.130.167.85" dyno= connect= service= status=503 bytes= protocol=https

Спасибо!

1 Ответ

0 голосов
/ 16 марта 2020

Наконец, мне пришлось создать Procfile со следующей информацией:

web: java -Dserver.port=$PORT -jar target/backend-coding-challenge-1.0-SNAPSHOT.jar

и добавить следующий плагин в pom. xml:

<build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
          <mainClass>com.heroku.CityAutocompleteService</mainClass>
        </configuration>

        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...