質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Java EE

Java EE(Java Enterprise Edition)はJavaベースのテクノロジーとその相互運用の仕様をまとめたものです。サーバとクライアントのアーキテクチャを規定し、特定アプリケーションのクラス用に定義されたテクノロジー設定のプロファイルを使用します。

Apache Maven

Apache Mavenは、ソフトウェアプロジェクトの管理ツールです。

Q&A

1回答

2612閲覧

herokuでデプロイするときに、Application errorが出る(Javaアプリケーション)

ridein

総合スコア0

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Java EE

Java EE(Java Enterprise Edition)はJavaベースのテクノロジーとその相互運用の仕様をまとめたものです。サーバとクライアントのアーキテクチャを規定し、特定アプリケーションのクラス用に定義されたテクノロジー設定のプロファイルを使用します。

Apache Maven

Apache Mavenは、ソフトウェアプロジェクトの管理ツールです。

0グッド

1クリップ

投稿2020/09/18 17:41

前提・実現したいこと

MavenとHeroku触れて2日目です。
eclipseを使用、言語Javaでwebappを作っており、herokuでデプロイしようとしています。

デプロイをしようとherokuのサイトでDeploy Branch を押すと、Build finishedとなり動作終了まではいくのですが、
そのあと出てきたURLにアクセスするとApplication errorと出てきてしまいます。

logを確認すると、「Unable to access jarfile target/dependency/webapp-runner.jar」とエラーが出ていました。(下記参照)
これはどのようなエラーで、対処法はありますか?

target/dependency/webapp-runner.jarがなかったので作ればいいのか?と思い、フォルダを作りwebapp-runner.jarをダウンロードしてもう一度試したのですが、同じエラーが出てきました。

エラーメッセージの欄には、logのエラー部分
該当のソースコードには、pom.xmlとProcfileを載せておきます。
必要なものがあれば追記させていただきます。

発生している問題・エラーメッセージ

log

12020-09-18T16:52:20.000000+00:00 app[api]: Build succeeded 22020-09-18T16:52:21.927432+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port 36734 target/*.war` 32020-09-18T16:52:24.723735+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them. 42020-09-18T16:52:24.730539+00:00 app[web.1]: Error: Unable to access jarfile target/dependency/webapp-runner.jar 52020-09-18T16:52:24.808951+00:00 heroku[web.1]: Process exited with status 1 62020-09-18T16:52:24.855892+00:00 heroku[web.1]: State changed from starting to crashed 72020-09-18T16:52:25.699771+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=restest0141.herokuapp.com request_id=065f9147-a355-4298-a616-72fc36f583af fwd="133.206.116.0" dyno= connect= service= status=503 bytes= protocol=https 82020-09-18T16:52:25.923104+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=restest0141.herokuapp.com request_id=42a14630-a9bf-4941-b448-9877e7268265 fwd="133.206.116.0" dyno= connect= service= status=503 bytes= protocol=https

該当のソースコード

pom.xml

1<?xml version="1.0" encoding="UTF-8"?> 2 3<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 5 <modelVersion>4.0.0</modelVersion> 6 7 <groupId>restest</groupId> 8 <artifactId>rastest</artifactId> 9 <version>0.0.1-SNAPSHOT</version> 10 <packaging>war</packaging> 11 12 <name>rastest Maven Webapp</name> 13 <!-- FIXME change it to the project's website --> 14 <url>http://www.example.com</url> 15 16 <properties> 17 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 18 <maven.compiler.source>1.8</maven.compiler.source> 19 <maven.compiler.target>1.8</maven.compiler.target> 20 </properties> 21 22 <dependencies> 23 <dependency> 24 <groupId>junit</groupId> 25 <artifactId>junit</artifactId> 26 <version>4.11</version> 27 <scope>test</scope> 28 </dependency> 29 <dependency> 30 <groupId>javax.servlet</groupId> 31 <artifactId>javax.servlet-api</artifactId> 32 <version>4.0.1</version> 33 <scope>provided</scope> 34 </dependency> 35 <dependency> 36 <groupId>com.fasterxml.jackson.core</groupId> 37 <artifactId>jackson-annotations</artifactId> 38 <version>2.11.2</version> 39 </dependency> 40 <dependency> 41 <groupId>com.fasterxml.jackson.core</groupId> 42 <artifactId>jackson-core</artifactId> 43 <version>2.11.2</version> 44 </dependency> 45 <dependency> 46 <groupId>com.fasterxml.jackson.core</groupId> 47 <artifactId>jackson-databind</artifactId> 48 <version>2.11.2</version> 49 </dependency> 50 <dependency> 51 <groupId>mysql</groupId> 52 <artifactId>mysql-connector-java</artifactId> 53 <version>8.0.21</version> 54 </dependency> 55 <dependency> 56 <groupId>javax.servlet</groupId> 57 <artifactId>jsp-api</artifactId> 58 <version>2.0</version> 59 <scope>provided</scope> 60 </dependency> 61 62 <!-- https://mvnrepository.com/artifact/com.github.jsimone/webapp-runner --> 63<dependency> 64 <groupId>com.github.jsimone</groupId> 65 <artifactId>webapp-runner</artifactId> 66 <version>7.0.22.1</version> 67 <scope>provided</scope> 68</dependency> 69 70 </dependencies> 71 72 <build> 73 <finalName>rastest</finalName> 74 <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> 75 <plugins> 76 <plugin> 77 <artifactId>maven-clean-plugin</artifactId> 78 <version>3.1.0</version> 79 </plugin> 80 <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging --> 81 <plugin> 82 <artifactId>maven-resources-plugin</artifactId> 83 <version>3.0.2</version> 84 </plugin> 85 <plugin> 86 <groupId>org.apache.maven.plugins</groupId> 87 <artifactId>maven-compiler-plugin</artifactId> 88 <version>3.6.2</version> 89 <configuration> 90 <source>1.8</source> 91 <target>1.8</target> 92 </configuration> 93 94 </plugin> 95 <plugin> 96 <artifactId>maven-surefire-plugin</artifactId> 97 <version>2.22.1</version> 98 </plugin> 99 <plugin> 100 <artifactId>maven-war-plugin</artifactId> 101 <version>3.2.2</version> 102 </plugin> 103 <plugin> 104 <artifactId>maven-install-plugin</artifactId> 105 <version>2.5.2</version> 106 </plugin> 107 <plugin> 108 <artifactId>maven-deploy-plugin</artifactId> 109 <version>2.8.2</version> 110 </plugin> 111 112 <plugin> 113 <groupId>org.apache.maven.plugins</groupId> 114 <artifactId>maven-dependency-plugin</artifactId> 115 <executions> 116 <execution> 117 <phase>package</phase> 118 <goals><goal>copy</goal></goals> 119 <configuration> 120 <artifactItems> 121 <artifactItem> 122 <groupId>com.github.jsimone</groupId> 123 <artifactId>webapp-runner</artifactId> 124 <version>7.0.27.1</version> 125 <destFileName>webapp-runner.jar</destFileName> 126 </artifactItem> 127 </artifactItems> 128 </configuration> 129 </execution> 130 </executions> 131 </plugin> 132 133 </plugins> 134 </pluginManagement> 135 </build> 136</project>

Procfile

1web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war

補足情報(FW/ツールのバージョンなど)

JDK 1.8
Maven 3.6.2
何を載せればよいのかわからなかったので、必要なものがあれば追記させていただきます。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

時間がたったので、もう解決済みかもですが

bash

1mvn clean compile 2mvn package

を実行後(mvn packegeでwebapp-runner.jarがtarget/dependencyにcopyされます)

bash

1heroku local web

を実行してみてください。

投稿2021/03/28 00:25

johanneskrauser

総合スコア20

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問