@ryoya828 (Ryoya)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

tomcat warデプロイについて

stsで作成したApplicationをtomcatサーバーにデプロイ→実行させたい

stsでWebアプリケーションを作成(Gradleプロジェクト)→ローカル環境で動作確認→実行確認OK。
スクリーンショット (202).png
次のステップとしてアプリケーションをwarファイルに変換→tomcatサーバーにデプロイ→実行確認をしたところでブラウザ上に404エラー発生し、エラー原因が分からず進めずにいます。
スクリーンショット (3).png

localhostでtomcatページは見れるのですが、ローカル環境で確認したのと同様にアドレス追加してブラウザ更新すると404エラーとなります。
スクリーンショット (5).png

こちらで下記要因を考え実行したのですが上手くいかず、

  1. warファイルが上手く作れていない?→再作成→デプロイ→404エラー
  2. Grableの設定がおかしい?→内容確認・修正→war作成→デプロイ→404エラー

他要因として、ローカル環境で確認したURLと、リモート環境で実行できるURLが違うか?も考えたのですが、一度こちらでお力を借りようと思い投降した次第です。

war作成時に改定したbuil.gradle

build.gradle
plugins {
	id 'org.springframework.boot' version '2.7.2'
	id 'io.spring.dependency-management' version '1.0.12.RELEASE'
	id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
	mavenCentral()
}

apply plugin: 'war'
war {
    archiveName 'ecsite.war'
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
	implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
	implementation 'org.springframework.boot:spring-boot-starter-web'
	runtimeOnly 'org.postgresql:postgresql'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
	implementation 'com.google.code.gson:gson'
	providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
}

tasks.named('test') {
	useJUnitPlatform()
}

考えられる要因などありましたらご教示お願いしたく存じます。
よろしくお願い致します。

0 likes

No Answers yet.

Your answer might help someone💌