teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

4

削除された内容の復元を行いました

2020/12/22 02:25

投稿

661245
661245

スコア0

title CHANGED
@@ -1,1 +1,1 @@
1
- ああああああああああ
1
+ Spring BootでJavaのWebサービス デプロイができません
body CHANGED
@@ -1,1 +1,101 @@
1
+ ### 前提・実現したいこと
2
+ Spring BootでJavaのWebサービスを作っているのですが、デプロイが上手くできません。
3
+ warファイルを書き出し、外部Tomcatにデプロイしています。
4
+ どうかお力添え頂きたいです。
5
+ ### 発生している問題・エラーメッセージ
6
+ warファイルをtomcatで表示させると、HTMLのindexファイルのページが表示されるのみ。
7
+ ページ遷移するとWhitelabel Error Page。
8
+ また、DateTimeFormatterの日付表示がされない事から、JavaのControllerが機能していないようです。
9
+ Spring Tool Suiteから実行した場合は動作しています。
10
+ ### 該当のソースコード
11
+ ```Controller1
12
+ package com.konbini.model.controller;
13
+ import java.time.LocalDate;
1
- うわああああああああああああああああああああああああああああああああああああああああ
14
+ import java.time.format.DateTimeFormatter;
15
+ import java.util.Arrays;
16
+ import java.util.List;
17
+ import java.util.Locale;
18
+ import org.springframework.stereotype.Controller;
19
+ import org.springframework.ui.Model;
20
+ import org.springframework.web.bind.annotation.RequestMapping;
21
+ @Controller
22
+ @RequestMapping("/konbini")
23
+ public class Controller1{
24
+
25
+ LocalDate D = LocalDate.now();
26
+ DateTimeFormatter df = DateTimeFormatter.ofPattern("MM月dd日(E)",Locale.JAPANESE);
27
+
28
+ @RequestMapping("/")
29
+ public String index(Model model) {
30
+ model.addAttribute("date",df.format(D));
31
+ return "index";
32
+ }
33
+
34
+ @RequestMapping("/order")
35
+ public String order(Model model) {
36
+ List<String> dList = Arrays.asList(
37
+ df.format(D),df.format(D.minusDays(1)),df.format(D.minusDays(2)),
38
+ df.format(D.minusDays(3)),df.format(D.minusDays(4)),
39
+ df.format(D.minusDays(5)),df.format(D.minusDays(6))
40
+ );
41
+
42
+ model.addAttribute("date",dList);
43
+ return "order";
44
+ }
45
+ }
46
+ ```
47
+ ```buildGradle
48
+ plugins {
49
+ id 'org.springframework.boot' version '2.4.0'
50
+ id 'io.spring.dependency-management' version '1.0.10.RELEASE'
51
+ id 'java'
52
+ id 'war'
53
+ }
54
+ war {
55
+ enabled = true
56
+ archiveName 'KB.war'
57
+ }
58
+ group = 'com.konbini'
59
+ version = '0.0.1-SNAPSHOT'
60
+ sourceCompatibility = '1.8'
61
+ targetCompatibility = '1.8'
62
+ repositories {
63
+ mavenCentral()
64
+ }
65
+ dependencies {
66
+ implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
67
+ implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
68
+ implementation 'org.springframework.boot:spring-boot-starter-web'
69
+ runtimeOnly 'mysql:mysql-connector-java'
70
+ testImplementation 'org.springframework.boot:spring-boot-starter-test'
71
+ providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
72
+ }
73
+ test {
74
+ useJUnitPlatform()
75
+ }
76
+ ```
77
+ ```MAIN
78
+ package com.konbini;
79
+ import org.springframework.boot.SpringApplication;
80
+ import org.springframework.boot.autoconfigure.SpringBootApplication;
81
+ import org.springframework.boot.builder.SpringApplicationBuilder;
82
+ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
83
+ @SpringBootApplication
84
+ public class KonbiniApplication extends SpringBootServletInitializer {
85
+ public static void main(String[] args) {
86
+ SpringApplication.run(KonbiniApplication.class, args);
87
+ }
88
+ @Override
89
+ protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
90
+ return application.sources(KonbiniApplication.class);
91
+ }
92
+ }
93
+ ```
94
+ ### 試したこと
95
+ 参考にしたサイト
96
+ https://qiita.com/TEBASAKI/items/7a22c8b6ac6eb5f1c304
97
+ ### 補足情報(FW/ツールのバージョンなど)
98
+ Spring Tool Suite 4.7.2
99
+ Java8
100
+ XAMPP v3.2.4
101
+ Apache Tomcat/7.0.107

3

2020/12/22 02:25

投稿

退会済みユーザー
title CHANGED
@@ -1,1 +1,1 @@
1
- Spring BootでJavaのWebサービス デプロイができません
1
+ ああああああああああ
body CHANGED
File without changes

2

2020/12/21 11:36

投稿

661245
661245

スコア0

title CHANGED
File without changes
body CHANGED
@@ -1,1 +1,1 @@
1
- ああああああああああああああああああああああああああああああああああああああああ
1
+ うわああああああああああああああああああああああああああああああああああああああああ

1

2020/12/21 11:35

投稿

661245
661245

スコア0

title CHANGED
File without changes
body CHANGED
@@ -1,128 +1,1 @@
1
- ### 前提・実現したいこと
2
-
3
- Spring BootでJavaのWebサービスを作っているのですが、デプロイが上手くできません。
4
- warファイルを書き出し、外部Tomcatにデプロイしています。
5
-
6
- どうかお力添え頂きたいです。
7
-
8
- ### 発生している問題・エラーメッセージ
9
-
10
- warファイルをtomcatで表示させると、HTMLのindexファイルのページが表示されるのみ。
11
- ページ遷移するとWhitelabel Error Page。
12
- また、DateTimeFormatterの日付表示がされない事から、JavaのControllerが機能していないようです。
13
-
14
- Spring Tool Suiteから実行した場合は動作しています。
15
-
16
- ### 該当のソースコード
17
-
18
- ```Controller1
19
- package com.konbini.model.controller;
20
-
21
- import java.time.LocalDate;
22
- import java.time.format.DateTimeFormatter;
23
- import java.util.Arrays;
24
- import java.util.List;
25
- import java.util.Locale;
26
-
27
- import org.springframework.stereotype.Controller;
28
- import org.springframework.ui.Model;
29
-
30
- import org.springframework.web.bind.annotation.RequestMapping;
31
-
32
- @Controller
33
- @RequestMapping("/konbini")
34
- public class Controller1{
35
-
36
- LocalDate D = LocalDate.now();
37
- DateTimeFormatter df = DateTimeFormatter.ofPattern("MM月dd日(E)",Locale.JAPANESE);
38
-
39
- @RequestMapping("/")
40
- public String index(Model model) {
41
- model.addAttribute("date",df.format(D));
42
- return "index";
43
- }
44
-
45
- @RequestMapping("/order")
1
+ ああああああああああああああああああああああああああああああああああああああああ
46
- public String order(Model model) {
47
- List<String> dList = Arrays.asList(
48
- df.format(D),df.format(D.minusDays(1)),df.format(D.minusDays(2)),
49
- df.format(D.minusDays(3)),df.format(D.minusDays(4)),
50
- df.format(D.minusDays(5)),df.format(D.minusDays(6))
51
- );
52
-
53
- model.addAttribute("date",dList);
54
- return "order";
55
- }
56
- }
57
-
58
- ```
59
-
60
- ```buildGradle
61
- plugins {
62
- id 'org.springframework.boot' version '2.4.0'
63
- id 'io.spring.dependency-management' version '1.0.10.RELEASE'
64
- id 'java'
65
- id 'war'
66
- }
67
-
68
- war {
69
- enabled = true
70
- archiveName 'KB.war'
71
- }
72
- group = 'com.konbini'
73
- version = '0.0.1-SNAPSHOT'
74
- sourceCompatibility = '1.8'
75
- targetCompatibility = '1.8'
76
-
77
- repositories {
78
- mavenCentral()
79
- }
80
-
81
-
82
- dependencies {
83
- implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
84
- implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
85
- implementation 'org.springframework.boot:spring-boot-starter-web'
86
- runtimeOnly 'mysql:mysql-connector-java'
87
- testImplementation 'org.springframework.boot:spring-boot-starter-test'
88
- providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
89
- }
90
-
91
- test {
92
- useJUnitPlatform()
93
- }
94
-
95
- ```
96
- ```MAIN
97
- package com.konbini;
98
-
99
- import org.springframework.boot.SpringApplication;
100
- import org.springframework.boot.autoconfigure.SpringBootApplication;
101
- import org.springframework.boot.builder.SpringApplicationBuilder;
102
- import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
103
-
104
- @SpringBootApplication
105
- public class KonbiniApplication extends SpringBootServletInitializer {
106
-
107
- public static void main(String[] args) {
108
- SpringApplication.run(KonbiniApplication.class, args);
109
- }
110
- @Override
111
- protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
112
- return application.sources(KonbiniApplication.class);
113
- }
114
-
115
- }
116
- ```
117
-
118
- ### 試したこと
119
-
120
- 参考にしたサイト
121
- https://qiita.com/TEBASAKI/items/7a22c8b6ac6eb5f1c304
122
-
123
- ### 補足情報(FW/ツールのバージョンなど)
124
-
125
- Spring Tool Suite 4.7.2
126
- Java8
127
- XAMPP v3.2.4
128
- Apache Tomcat/7.0.107