makoxti
@makoxti

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

Dockerを起動させるとMavenWrapperMainクラスがないと怒られる

Q&A

Closed

解決したいこと

ビルドが成功し、SpringBoot+PostgresのアプリケーションをDockerで起動できるようにする

gitRepository

発生している問題・エラー

app        | ./pictgram/mvnw: line 276: /app/.mvn/wrapper/maven-wrapper.properties: No such file or directory
app        |   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
app        |                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /app/.mvn/wrapper/maven-wrapper.jar: No 
app        | Warning: such file or directory
  2 50710    2  1072    0     0   2170      0  0:00:23 --:--:--  0:00:23  2165
app        | curl: (23) Failed writing body (0 != 1072)
app        | Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
app        | Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
app exited with code 1
app        | ./pictgram/mvnw: line 276: /app/.mvn/wrapper/maven-wrapper.properties: No such file or directory
app        |   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
app        |                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /app/.mvn/wrapper/maven-wrapper.jar: No 
app        | Warning: such file or directory
  2 50710    2  1072    0     0   2174      0  0:00:23 --:--:--  0:00:23  2174
app        | curl: (23) Failed writing body (0 != 1072)
app        | Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
app        | Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
app exited with code 1
app        | ./pictgram/mvnw: line 276: /app/.mvn/wrapper/maven-wrapper.properties: No such file or directory
app        |   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
app        |                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /app/.mvn/wrapper/maven-wrapper.jar: No 
app        | Warning: such file or directory
  2 50710    2  1072    0     0   2081      0  0:00:24 --:--:--  0:00:24  2077
app        | curl: (23) Failed writing body (0 != 1072)
app        | Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
app        | Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
app exited with code 1
app        | ./pictgram/mvnw: line 276: /app/.mvn/wrapper/maven-wrapper.properties: No such file or directory
app        |   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
app        |                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /app/.mvn/wrapper/maven-wrapper.jar: No 
app        | Warning: such file or directory
  2 50710    2  1406    0     0   2714      0  0:00:18 --:--:--  0:00:18  2709
app        | curl: (23) Failed writing body (0 != 1406)
app        | Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
app        | Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
app exited with code 1
app        | ./pictgram/mvnw: line 276: /app/.mvn/wrapper/maven-wrapper.properties: No such file or directory
app        |   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
app        |                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /app/.mvn/wrapper/maven-wrapper.jar: No 
app        | Warning: such file or directory
  2 50710    2  1071    0     0   2176      0  0:00:23 --:--:--  0:00:23  2181
app        | curl: (23) Failed writing body (0 != 1071)
app        | Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
app        | Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
app exited with code 1
app        | ./pictgram/mvnw: line 276: /app/.mvn/wrapper/maven-wrapper.properties: No such file or directory
app        |   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
app        |                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /app/.mvn/wrapper/maven-wrapper.jar: No 
app        | Warning: such file or directory
  2 50710    2  1072    0     0   2285      0  0:00:22 --:--:--  0:00:22  2280
app        | curl: (23) Failed writing body (0 != 1072)
app        | Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
app        | Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
app exited with code 1
app        | ./pictgram/mvnw: line 276: /app/.mvn/wrapper/maven-wrapper.properties: No such file or directory
app        |   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
app        |                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /app/.mvn/wrapper/maven-wrapper.jar: No 
app        | Warning: such file or directory
  2 50710    2  1072    0     0   2053      0  0:00:24 --:--:--  0:00:24  2053
app        | curl: (23) Failed writing body (0 != 1072)
app        | Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
app        | Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
app exited with code 1
app        | ./pictgram/mvnw: line 276: /app/.mvn/wrapper/maven-wrapper.properties: No such file or directory
app        |   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
app        |                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /app/.mvn/wrapper/maven-wrapper.jar: No 
app        | Warning: such file or directory
  2 50710    2  1072    0     0   2135      0  0:00:23 --:--:--  0:00:23  2135
app        | curl: (23) Failed writing body (0 != 1072)
app        | Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
app        | Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
app exited with code 1
app        | ./pictgram/mvnw: line 276: /app/.mvn/wrapper/maven-wrapper.properties: No such file or directory
app        |   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
app        |                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /app/.mvn/wrapper/maven-wrapper.jar: No 
app        | Warning: such file or directory
  2 50710    2  1078    0     0   1730      0  0:00:29 --:--:--  0:00:29  1727
app        | curl: (23) Failed writing body (0 != 1078)
app        | Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
app        | Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
app exited with code 1
app        | ./pictgram/mvnw: line 276: /app/.mvn/wrapper/maven-wrapper.properties: No such file or directory
app        |   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
app        |                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /app/.mvn/wrapper/maven-wrapper.jar: No 
app        | Warning: such file or directory
  2 50710    2  1078    0     0   1764      0  0:00:28 --:--:--  0:00:28  1764
app        | curl: (23) Failed writing body (0 != 1078)
app        | Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
app        | Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
app exited with code 1
app        | ./pictgram/mvnw: line 276: /app/.mvn/wrapper/maven-wrapper.properties: No such file or directory
app        |   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
app        |                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /app/.mvn/wrapper/maven-wrapper.jar: No 
app        | Warning: such file or directory
  2 50710    2  1072    0     0   1963      0  0:00:25 --:--:--  0:00:25  1963
app        | curl: (23) Failed writing body (0 != 1072)
app        | Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
app        | Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
app exited with code 1
app        | ./pictgram/mvnw: line 276: /app/.mvn/wrapper/maven-wrapper.properties: No such file or directory
app        |   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
app        |                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /app/.mvn/wrapper/maven-wrapper.jar: No 
app        | Warning: such file or directory
  2 50710    2  1072    0     0   1996      0  0:00:25 --:--:--  0:00:25  1996
app        | curl: (23) Failed writing body (0 != 1072)
app        | Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
app        | Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
app exited with code 1
app        | ./pictgram/mvnw: line 276: /app/.mvn/wrapper/maven-wrapper.properties: No such file or directory
app        |   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
app        |                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /app/.mvn/wrapper/maven-wrapper.jar: No 
app        | Warning: such file or directory
  2 50710    2  1072    0     0   2152      0  0:00:23 --:--:--  0:00:23  2148
app        | curl: (23) Failed writing body (0 != 1072)
app        | Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
app        | Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
app exited with code 1
app        | ./pictgram/mvnw: line 276: /app/.mvn/wrapper/maven-wrapper.properties: No such file or directory
app        |   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
app        |                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /app/.mvn/wrapper/maven-wrapper.jar: No 
app        | Warning: such file or directory
  2 50710    2  1072    0     0   2026      0  0:00:25 --:--:--  0:00:25  2026
app        | curl: (23) Failed writing body (0 != 1072)
app        | Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
app        | Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
app exited with code 1

よろしくお願いします。
0

1Answer

エラーログで検索すると、次の情報が見つかりました.
https://www.baeldung.com/maven-wrapper

そして、次の 1〜4 のように実行すると、5 の通りアプリが起動しました.

Spring のことは分かりませんが、3 の「./mvnw clean install」が必要なようです.
(私は正しい手順を知らないので、学習のために参考にされたサイトを読み返していただくのが良いと思います)

1. app コンテナを 100時間(360000秒)起動させる

springbootアプリケーションをdocker-composeで動かしたい でご連絡した Service「app」を sleep 360000 として稼働させる

2. app コンテナにログインする

$ docker-compose exec app bash

3. コンテナ内で次を実行する

bash-4.4# cd pictgram
bash-4.4# ./mvnw clean install
(何やら大量に jar?がインストールされている)

4. spring-boot:run を実行する

bash-4.4# ./mvnw spring-boot:run

5. Web-UI から localhost:8080 にアクセスしてみる

image.png

0Like

Comments

  1. @makoxti

    Questioner

    ありがとうございます!
    私も画面開けました。

Your answer might help someone💌