前提
Spring bootとpostgreSQLで簡単なメモアプリを作成しています。
local環境で望んだ仕上がりまで実装が終わったため、Herokuでの公開を試みたのですが、
「Application error」の画面に遷移してしまい、正常に動作しません。
実現したいこと
Herokuへのデプロイを正常に行いたい
発生している問題・エラーメッセージ
herokulogsで出力したエラーメッセージ
1 22022-08-01T07:08:54.000000+00:00 app[api]: Build started by user メールアドレス 32022-08-01T07:09:35.833882+00:00 app[api]: Release v8 created by user メールアドレス 42022-08-01T07:09:35.833882+00:00 app[api]: Deploy f8d4c9ec by user メールアドレス 52022-08-01T07:09:36.141999+00:00 heroku[web.1]: State changed from crashed to starting 62022-08-01T07:09:40.770443+00:00 heroku[web.1]: Starting process with command `java -Dserver.port=24442 $JAVA_OPTS -jar build/libs/アプリ名-0.0.1-SNAPSHOT.jar` 72022-08-01T07:09:41.887519+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them. 82022-08-01T07:09:41.890292+00:00 app[web.1]: Error: Unable to access jarfile build/libs/アプリ名-0.0.1-SNAPSHOT.jar 92022-08-01T07:09:42.066430+00:00 heroku[web.1]: Process exited with status 1 102022-08-01T07:09:42.432110+00:00 heroku[web.1]: State changed from starting to crashed 112022-08-01T07:09:42.438130+00:00 heroku[web.1]: State changed from crashed to starting 122022-08-01T07:09:46.694985+00:00 heroku[web.1]: Starting process with command `java -Dserver.port=6526 $JAVA_OPTS -jar build/libs/アプリ名-0.0.1-SNAPSHOT.jar` 132022-08-01T07:09:47.453497+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them. 142022-08-01T07:09:47.454778+00:00 app[web.1]: Error: Unable to access jarfile build/libs/アプリ名-0.0.1-SNAPSHOT.jar 152022-08-01T07:09:47.575633+00:00 heroku[web.1]: Process exited with status 1 162022-08-01T07:09:47.762689+00:00 heroku[web.1]: State changed from starting to crashed 172022-08-01T07:09:52.000000+00:00 app[api]: Build succeeded 182022-08-01T07:10:07.490607+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=アプリ名.herokuapp.com request_id=36b7e7d9-0441-491c-b184-a69f6c56ef4e fwd="106.72.48.98" dyno= connect= service= status=503 bytes= protocol=https 192022-08-01T07:10:07.703205+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=アプリ名.herokuapp.com request_id=7d5b8960-4869-468c-a379-11692ca82baf fwd="106.72.48.98" dyno= connect= service= status=503 bytes= protocol=https 202022-08-01T07:17:57.776638+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=アプリ名.herokuapp.com request_id=13aa39ff-2e63-4864-aa4b-280e092b9256 fwd="106.72.48.98" dyno= connect= service= status=503 bytes= protocol=https 212022-08-01T07:17:57.971570+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=アプリ名.herokuapp.com request_id=e7d2215c-0ad8-4a64-a775-0df9b84e5c8a fwd="106.72.48.98" dyno= connect= service= status=503 bytes= protocol=https 22
jarファイルが読み込めていないみたいですが、なぜ読み込めないかわかりませんでした…
関連ファイル
build.gradle
1plugins { 2 id 'org.springframework.boot' version '2.7.0' 3 id 'io.spring.dependency-management' version '1.0.11.RELEASE' 4 id 'java' 5} 6 7group = 'com.アプリ名' 8version = '0.0.1-SNAPSHOT' 9sourceCompatibility = '17' 10 11configurations { 12 compileOnly { 13 extendsFrom annotationProcessor 14 } 15} 16 17repositories { 18 mavenCentral() 19} 20 21dependencies { 22 implementation 'org.springframework.boot:spring-boot-starter-data-jpa' 23 implementation 'org.springframework.boot:spring-boot-starter-security' 24 implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' 25 implementation 'org.springframework.boot:spring-boot-starter-web' 26 implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5' 27 compileOnly 'org.projectlombok:lombok' 28 developmentOnly 'org.springframework.boot:spring-boot-devtools' 29 runtimeOnly 'org.postgresql:postgresql' 30 annotationProcessor 'org.projectlombok:lombok' 31 testImplementation 'org.springframework.boot:spring-boot-starter-test' 32 testImplementation 'org.springframework.security:spring-security-test' 33 implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect' 34 implementation 'com.atilika.kuromoji:kuromoji-ipadic:0.9.0' 35 implementation 'org.springframework.boot:spring-boot-starter-validation' 36 implementation 'org.springframework.boot:spring-boot-starter-mail:2.7.1' 37 implementation 'org.passay:passay:1.6.1' 38 compileOnly 'com.github.jsimone:webapp-runner:9.0.27.1' 39 implementation 'org.apache.maven.plugins:maven-compiler-plugin:3.10.1' 40 41} 42 43tasks.named('test') { 44 useJUnitPlatform() 45} 46 47task stage(dependsOn: ['build', 'clean']) 48build.mustRunAfter clean 49 50jar { 51manifest { 52enabled = false 53 } 54} 55 56
Procfile
1web: java -Dserver.port=$PORT $JAVA_OPTS -jar build/libs/アプリ名-0.0.1-SNAPSHOT.jar
gitignore
1HELP.md 2.gradle 3build/ 4!gradle/wrapper/gradle-wrapper.jar 5!**/src/main/**/build/ 6!**/src/test/**/build/ 7 8### STS ### 9.apt_generated 10.classpath 11.factorypath 12.project 13.settings 14.springBeans 15.sts4-cache 16bin/ 17!**/src/main/**/bin/ 18!**/src/test/**/bin/ 19 20### IntelliJ IDEA ### 21.idea 22*.iws 23*.iml 24*.ipr 25out/ 26!**/src/main/**/out/ 27!**/src/test/**/out/ 28 29### NetBeans ### 30/nbproject/private/ 31/nbbuild/ 32/dist/ 33/nbdist/ 34/.nb-gradle/ 35 36### VS Code ### 37.vscode/ 38
system.properties
1java.runtime.version=17
いずれもプロジェクトフォルダ直下にあります。
試したこと
▼ターミナルで下記コマンドの実行
git add -f build/libs/アプリ名-0.0.1-SNAPSHOT.jar
git push heroku master
→Everything up-to-dateと表示され、特に他のログに変化なし
▼下記サイトを参考に、build.gradleに下記コードを追加
https://zenn.dev/otkshol/articles/db34b50fee53f7
jar {
manifest {
enabled = false
}
}
→特に変化なし
▼コンソールを確認
→
heroku run consoleと打ったところ、
Running console on ⬢ アプリ名... up, run.4080 (Free)
bash: console: command not foundとの表示で確認できず
補足情報(FW/ツールのバージョンなど)
SpringFramework 2.7.0
OpenJDK 64-Bit Server VM Temurin-17.0.3+7
理解が浅く、頓珍漢な質問でしたら申し訳ございません。
ご教示いただけますと幸いです。

回答1件
あなたの回答
tips
プレビュー