herokuでデプロイしたが、404エラーになる
解決したいこと
herokuの404エラー
javaのmavenプロジェクトでjspやServletを使ったWebアプリケーションを作成し、webapp-runnerを使ってherokuでデプロイできましたが、404エラーとなりました。
githubと連携してデプロイを行いました。
解決方法をご教授願いたいです。
以下ログや設定ファイルなどを記載しています。
ビルド時のログ
-----> Building on the Heroku-22 stack
-----> Using buildpack: heroku/java
-----> Java app detected
-----> Installing OpenJDK 1.8... done
-----> Installing Maven 3.9.4... done
-----> Executing Maven
$ mvn -DskipTests clean dependency:list install
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< mavenWebapp:BandScheduler-app >--------------------
[INFO] Building BandScheduler-app Maven Webapp 0.0.1-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- clean:3.1.0:clean (default-clean) @ BandScheduler-app ---
[INFO] Deleting /tmp/build_2b549e44/target
[INFO]
[INFO] --- dependency:3.6.0:list (default-cli) @ BandScheduler-app ---
[INFO]
[INFO] --- resources:3.0.2:resources (default-resources) @ BandScheduler-app ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /tmp/build_2b549e44/src/main/resources
[INFO]
[INFO] --- compiler:3.8.0:compile (default-compile) @ BandScheduler-app ---
[INFO] No sources to compile
[INFO]
[INFO] --- resources:3.0.2:testResources (default-testResources) @ BandScheduler-app ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /tmp/build_2b549e44/src/test/resources
[INFO]
[INFO] --- compiler:3.8.0:testCompile (default-testCompile) @ BandScheduler-app ---
[INFO] No sources to compile
[INFO]
[INFO] --- surefire:2.22.1:test (default-test) @ BandScheduler-app ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- war:3.2.2:war (default-war) @ BandScheduler-app ---
[INFO] Packaging webapp
[INFO] Assembling webapp [BandScheduler-app] in [/tmp/build_2b549e44/target/BandScheduler-app]
[INFO] Processing war project
[INFO] Webapp assembled in [31 msecs]
[INFO] Building war: /tmp/build_2b549e44/target/BandScheduler-app.war
[INFO]
[INFO] --- dependency:3.6.0:copy (default) @ BandScheduler-app ---
[INFO] Configured Artifact: com.heroku:webapp-runner:9.0.41.0:jar
[INFO] Copying webapp-runner-9.0.41.0.jar to /tmp/build_2b549e44/target/dependency/webapp-runner.jar
[INFO]
[INFO] --- install:2.5.2:install (default-install) @ BandScheduler-app ---
[INFO] Installing /tmp/build_2b549e44/target/BandScheduler-app.war to /tmp/codon/tmp/cache/.m2/repository/mavenWebapp/BandScheduler-app/0.0.1-SNAPSHOT/BandScheduler-app-0.0.1-SNAPSHOT.war
[INFO] Installing /tmp/build_2b549e44/pom.xml to /tmp/codon/tmp/cache/.m2/repository/mavenWebapp/BandScheduler-app/0.0.1-SNAPSHOT/BandScheduler-app-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.692 s
[INFO] Finished at: 2024-07-26T09:30:19Z
[INFO] ------------------------------------------------------------------------
-----> Discovering process types
Procfile declares types -> web
-----> Compressing...
Done: 102.6M
-----> Launching...
Released v4
https://~herokuapp.com/ deployed to Heroku
This app is using the Heroku-22 stack, however a newer stack is available.
To upgrade to Heroku-24, see:
https://devcenter.heroku.com/articles/upgrading-to-the-latest-stack
heroku logsの出力
2024-07-26T09:14:50.000000+00:00 app[api]: Build succeeded
2024-07-26T09:14:50.428830+00:00 heroku[web.1]: Starting process with command java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port 53600 target/*.war
2024-07-26T09:14:51.010747+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2024-07-26T09:14:51.013812+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -XX:MaxRAM=536870912 -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
2024-07-26T09:14:51.226604+00:00 app[web.1]: Expanding BandScheduler-app.war into /app/target/tomcat.53600/webapps/expanded
2024-07-26T09:14:51.226641+00:00 app[web.1]: Adding Context for /app/target/tomcat.53600/webapps/expanded
2024-07-26T09:14:51.481793+00:00 app[web.1]: org.apache.coyote.AbstractProtocol init
2024-07-26T09:14:51.481805+00:00 app[web.1]: INFO: Initializing ProtocolHandler ["http-nio-53600"]
2024-07-26T09:14:51.497480+00:00 app[web.1]: org.apache.catalina.core.StandardService startInternal
2024-07-26T09:14:51.497481+00:00 app[web.1]: INFO: Starting service [Tomcat]
2024-07-26T09:14:51.497872+00:00 app[web.1]: org.apache.catalina.core.StandardEngine startInternal
2024-07-26T09:14:51.497873+00:00 app[web.1]: INFO: Starting Servlet engine: [Apache Tomcat/9.0.41]
2024-07-26T09:14:51.598459+00:00 app[web.1]: org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
2024-07-26T09:14:51.598461+00:00 app[web.1]: INFO: No global web.xml found
2024-07-26T09:14:51.646994+00:00 heroku[web.1]: State changed from starting to up
2024-07-26T09:14:52.872249+00:00 app[web.1]: org.apache.jasper.servlet.TldScanner scanJars
2024-07-26T09:14:52.872260+00:00 app[web.1]: INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2024-07-26T09:14:52.903607+00:00 app[web.1]: org.apache.coyote.AbstractProtocol start
2024-07-26T09:14:52.903610+00:00 app[web.1]: INFO: Starting ProtocolHandler ["http-nio-53600"]
2024-07-26T09:14:53.676895+00:00 heroku[router]: at=info method=GET path="/" host=~herokuapp.com request_id=905d189f-b159-4fdd-9f69-be9e7d31800e fwd="124.150.215.183" dyno=web.1 connect=0ms service=23ms status=404 bytes=906 protocol=https
2024-07-26T09:14:53.965462+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=~herokuapp.com request_id=bb2dc468-2742-4102-aae3-62dc06d3a4b4 fwd="124.150.215.183" dyno=web.1 connect=0ms service=2ms status=404 bytes=917 protocol=https
2024-07-26T09:14:56.125958+00:00 heroku[router]: at=info method=GET path="/" host=~herokuapp.com request_id=d6744ba4-e911-488c-9d9d-2f241fe1081e fwd="210.139.253.197" dyno=web.1 connect=0ms service=2ms status=404 bytes=906 protocol=https
404エラーの画像
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mavenWebapp</groupId>
<artifactId>BandScheduler-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>BandScheduler-app Maven Webapp</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>9.0.0</version>
</dependency>
</dependencies>
<build>
<finalName>BandScheduler-app</finalName>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>3.0.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals><goal>copy</goal></goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.heroku</groupId>
<artifactId>webapp-runner</artifactId>
<version>9.0.41.0</version>
<destFileName>webapp-runner.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
web.xml
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>BandScheduler</display-name>
<welcome-file-list>
<welcome-file>Login.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>LoginServlet</display-name>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>control.LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/login-servlet</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>SignupServlet</display-name>
<servlet-name>SignupServlet</servlet-name>
<servlet-class>control.SignupServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SignupServlet</servlet-name>
<url-pattern>/signup-servlet</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>DaysServlet</display-name>
<servlet-name>DaysServlet</servlet-name>
<servlet-class>control.DaysServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DaysServlet</servlet-name>
<url-pattern>/days-servlet</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>FormServlet</display-name>
<servlet-name>FormServlet</servlet-name>
<servlet-class>control.FormServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FormServlet</servlet-name>
<url-pattern>/form-servlet</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>ConfirmServlet</display-name>
<servlet-name>ConfirmServlet</servlet-name>
<servlet-class>control.ConfirmServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ConfirmServlet</servlet-name>
<url-pattern>/confirm-servlet</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>DeleteServlet</display-name>
<servlet-name>DeleteServlet</servlet-name>
<servlet-class>control.DeleteServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DeleteServlet</servlet-name>
<url-pattern>/delete-servlet</url-pattern>
</servlet-mapping>
</web-app>
Procfile
web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war
system.properties
java.runtime.version=1.8
自分で試したこと
・デプロイして生成されたURLのすぐ後に「/Login.jsp」を記述。
・web.xmlにorg.apache.jasper.servlet.JspServletを追加。
・jspファイルがsrc/main/webappの配下にあるかどうかの確認。
・WARファイルができているかどうかの確認。
宜しくお願い致します。