簡體   English   中英

Spring 在 Heroku 上啟動部署

[英]Spring Boot deploy on Heroku

我在 Heroku 上運行 spring 引導應用程序時遇到問題。應用程序崩潰並出現以下錯誤。 不知道問題出在哪里?

    2022-03-11T12:21:22.271773+00:00 heroku[web.1]: State changed from crashed to starting
2022-03-11T12:21:25.029966+00:00 heroku[web.1]: Starting process with command `java -Dserver.port=22103 $JAVA_OPTS -jar target/Vendulka-1.0-SNAPSHOT.jar`
2022-03-11T12:21:25.730599+00:00 app[web.1]: Create a Procfile to customize the command used to run this process: https://devcenter.heroku.com/articles/procfile
2022-03-11T12:21:25.740822+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2022-03-11T12:21:25.743826+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -XX:+UseContainerSupport -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8 
2022-03-11T12:21:25.785124+00:00 app[web.1]: no main manifest attribute, in target/Vendulka-1.0-SNAPSHOT.jar
2022-03-11T12:21:25.906791+00:00 heroku[web.1]: Process exited with status 1
2022-03-11T12:21:26.402088+00:00 heroku[web.1]: State changed from starting to crashed
2022-03-11T12:21:36.770036+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cerma.herokuapp.com request_id=44ef8283-7eae-4229-903a-ce32f9dda176 fwd="212.111.4.170" dyno= connect= service= status=503 bytes= protocol=https
2022-03-11T12:21:36.899660+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=cerma.herokuapp.com request_id=21242cc6-f151-4272-bf41-d5aa9b834442 fwd="212.111.4.170" dyno= connect= service= status=503 bytes= protocol=https
2022-03-11T12:21:21.118467+00:00 app[api]: Deploy 8ed3929c by user tcermak4@gmail.com
2022-03-11T12:21:21.118467+00:00 app[api]: Release v13 created by user tcermak4@gmail.com
2022-03-11T12:21:23.000000+00:00 app[api]: Build succeeded
2022-03-11T12:22:17.417029+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cerma.herokuapp.com request_id=8225fdab-1ffb-447a-a035-da3804e9305f fwd="212.111.4.170" dyno= connect= service= status=503 bytes= protocol=https
2022-03-11T12:22:17.883392+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cerma.herokuapp.com request_id=fbe85224-b825-4c5d-be85-3d0e50e633d1 fwd="212.111.4.170" dyno= connect= service= status=503 bytes= protocol=https
2022-03-11T12:22:18.132872+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=cerma.herokuapp.com request_id=cab1a218-f1df-443f-9fce-f32d76ac1830 fwd="212.111.4.170" dyno= connect= service= status=503 bytes= protocol=https

錯誤是no main manifest attribute ,這意味着 jar 文件沒有 Main-Class 屬性,請參閱設置應用程序的入口點

當您使用 Springboot 時,您可以使用spring-boot-maven-plugin並設置 mainClass

<plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>2.1.7.RELEASE</version>
            <configuration>
                <mainClass>com.example.App</mainClass>
            </configuration>
        <executions>
            <execution>
                <goals>
                    <goal>repackage</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM