質問編集履歴
4
エラーメッセージ
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,19 +22,17 @@
|
|
22
22
|
|
23
23
|
```
|
24
24
|
|
25
|
-
Whitelabel Error Page
|
26
|
-
|
27
25
|
This application has no explicit mapping for /error, so you are seeing this as a fallback.
|
28
26
|
|
29
27
|
|
30
28
|
|
31
|
-
Tue Apr 20 1
|
29
|
+
Tue Apr 20 14:05:02 JST 2021
|
32
30
|
|
33
31
|
There was an unexpected error (type=Internal Server Error, status=500).
|
34
32
|
|
35
|
-
Could not open JDBC Connection for transaction; nested exception is java.sql.SQL
|
36
|
-
|
37
|
-
org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQL
|
33
|
+
Could not open JDBC Connection for transaction; nested exception is java.sql.SQLNonTransientConnectionException: Could not create connection to database server.
|
34
|
+
|
35
|
+
org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLNonTransientConnectionException: Could not create connection to database server.
|
38
36
|
|
39
37
|
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:309)
|
40
38
|
|
@@ -42,176 +40,180 @@
|
|
42
40
|
|
43
41
|
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
|
44
42
|
|
43
|
+
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:595)
|
44
|
+
|
45
|
+
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:382)
|
46
|
+
|
47
|
+
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
|
48
|
+
|
49
|
+
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
|
50
|
+
|
45
51
|
以下省略
|
46
52
|
|
53
|
+
### 該当のソースコード
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
```pom.xml
|
58
|
+
|
59
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
60
|
+
|
61
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
62
|
+
|
63
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
64
|
+
|
65
|
+
<modelVersion>4.0.0</modelVersion>
|
66
|
+
|
67
|
+
<parent>
|
68
|
+
|
69
|
+
<groupId>org.springframework.boot</groupId>
|
70
|
+
|
71
|
+
<artifactId>spring-boot-starter-parent</artifactId>
|
72
|
+
|
73
|
+
<version>2.4.5</version>
|
74
|
+
|
75
|
+
<relativePath/> <!-- lookup parent from repository -->
|
76
|
+
|
77
|
+
</parent>
|
78
|
+
|
79
|
+
<groupId>com.example</groupId>
|
80
|
+
|
81
|
+
<artifactId>sprintgboot.test-6</artifactId>
|
82
|
+
|
83
|
+
<version>0.0.1-SNAPSHOT</version>
|
84
|
+
|
85
|
+
<packaging>war</packaging>
|
86
|
+
|
87
|
+
<name>sprintgboot.test-6</name>
|
88
|
+
|
89
|
+
<description>Demo project for Spring Boot</description>
|
90
|
+
|
91
|
+
<properties>
|
92
|
+
|
93
|
+
<java.version>11</java.version>
|
94
|
+
|
95
|
+
</properties>
|
96
|
+
|
97
|
+
<dependencies>
|
98
|
+
|
99
|
+
<dependency>
|
100
|
+
|
101
|
+
<groupId>org.springframework.boot</groupId>
|
102
|
+
|
103
|
+
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
104
|
+
|
105
|
+
</dependency>
|
106
|
+
|
107
|
+
<dependency>
|
108
|
+
|
109
|
+
<groupId>org.springframework.boot</groupId>
|
110
|
+
|
111
|
+
<artifactId>spring-boot-starter-validation</artifactId>
|
112
|
+
|
113
|
+
</dependency>
|
114
|
+
|
115
|
+
<dependency>
|
116
|
+
|
117
|
+
<groupId>org.springframework.boot</groupId>
|
118
|
+
|
119
|
+
<artifactId>spring-boot-starter-web</artifactId>
|
120
|
+
|
121
|
+
</dependency>
|
122
|
+
|
123
|
+
<dependency>
|
124
|
+
|
125
|
+
<groupId>org.mybatis.spring.boot</groupId>
|
126
|
+
|
127
|
+
<artifactId>mybatis-spring-boot-starter</artifactId>
|
128
|
+
|
129
|
+
<version>2.1.4</version>
|
130
|
+
|
131
|
+
</dependency>
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<dependency>
|
136
|
+
|
137
|
+
<groupId>org.springframework.boot</groupId>
|
138
|
+
|
139
|
+
<artifactId>spring-boot-devtools</artifactId>
|
140
|
+
|
141
|
+
<scope>runtime</scope>
|
142
|
+
|
143
|
+
<optional>true</optional>
|
144
|
+
|
145
|
+
</dependency>
|
146
|
+
|
147
|
+
<dependency>
|
148
|
+
|
149
|
+
<groupId>mysql</groupId>
|
150
|
+
|
151
|
+
<artifactId>mysql-connector-java</artifactId>
|
152
|
+
|
153
|
+
<scope>runtime</scope>
|
154
|
+
|
155
|
+
</dependency>
|
156
|
+
|
157
|
+
<dependency>
|
158
|
+
|
159
|
+
<groupId>org.springframework.boot</groupId>
|
160
|
+
|
161
|
+
<artifactId>spring-boot-starter-tomcat</artifactId>
|
162
|
+
|
163
|
+
<scope>provided</scope>
|
164
|
+
|
165
|
+
</dependency>
|
166
|
+
|
167
|
+
<dependency>
|
168
|
+
|
169
|
+
<groupId>org.springframework.boot</groupId>
|
170
|
+
|
171
|
+
<artifactId>spring-boot-starter-test</artifactId>
|
172
|
+
|
173
|
+
<scope>test</scope>
|
174
|
+
|
175
|
+
</dependency>
|
176
|
+
|
177
|
+
</dependencies>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
<build>
|
182
|
+
|
183
|
+
<plugins>
|
184
|
+
|
185
|
+
<plugin>
|
186
|
+
|
187
|
+
<groupId>org.springframework.boot</groupId>
|
188
|
+
|
189
|
+
<artifactId>spring-boot-maven-plugin</artifactId>
|
190
|
+
|
191
|
+
</plugin>
|
192
|
+
|
193
|
+
</plugins>
|
194
|
+
|
195
|
+
</build>
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
</project>
|
200
|
+
|
201
|
+
|
202
|
+
|
47
203
|
```
|
48
204
|
|
49
|
-
|
50
|
-
|
51
|
-
### 該当のソースコード
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
```pom.xml
|
56
|
-
|
57
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
58
|
-
|
59
|
-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
60
|
-
|
61
|
-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
62
|
-
|
63
|
-
<modelVersion>4.0.0</modelVersion>
|
64
|
-
|
65
|
-
<parent>
|
66
|
-
|
67
|
-
<groupId>org.springframework.boot</groupId>
|
68
|
-
|
69
|
-
<artifactId>spring-boot-starter-parent</artifactId>
|
70
|
-
|
71
|
-
<version>2.4.5</version>
|
72
|
-
|
73
|
-
<relativePath/> <!-- lookup parent from repository -->
|
74
|
-
|
75
|
-
</parent>
|
76
|
-
|
77
|
-
<groupId>com.example</groupId>
|
78
|
-
|
79
|
-
<artifactId>sprintgboot.test-6</artifactId>
|
80
|
-
|
81
|
-
<version>0.0.1-SNAPSHOT</version>
|
82
|
-
|
83
|
-
<packaging>war</packaging>
|
84
|
-
|
85
|
-
<name>sprintgboot.test-6</name>
|
86
|
-
|
87
|
-
<description>Demo project for Spring Boot</description>
|
88
|
-
|
89
|
-
<properties>
|
90
|
-
|
91
|
-
<java.version>11</java.version>
|
92
|
-
|
93
|
-
|
205
|
+
```application.properties
|
94
|
-
|
95
|
-
|
206
|
+
|
96
|
-
|
97
|
-
<dependency>
|
98
|
-
|
99
|
-
<groupId>org.springframework.boot</groupId>
|
100
|
-
|
101
|
-
|
207
|
+
spring.datasource.url=jdbc:mysql://localhost:3306/testdb?characterEncoding=UTF-8&serverTimezone=JST
|
102
|
-
|
208
|
+
|
103
|
-
|
209
|
+
spring.datasource.username=*****
|
104
|
-
|
105
|
-
|
210
|
+
|
106
|
-
|
107
|
-
<groupId>org.springframework.boot</groupId>
|
108
|
-
|
109
|
-
<artifactId>spring-boot-starter-validation</artifactId>
|
110
|
-
|
111
|
-
|
211
|
+
spring.datasource.password=*****
|
112
|
-
|
113
|
-
|
212
|
+
|
114
|
-
|
115
|
-
<groupId>org.springframework.boot</groupId>
|
116
|
-
|
117
|
-
|
213
|
+
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
118
|
-
|
119
|
-
</dependency>
|
120
|
-
|
121
|
-
<dependency>
|
122
|
-
|
123
|
-
<groupId>org.mybatis.spring.boot</groupId>
|
124
|
-
|
125
|
-
<artifactId>mybatis-spring-boot-starter</artifactId>
|
126
|
-
|
127
|
-
<version>2.1.4</version>
|
128
|
-
|
129
|
-
</dependency>
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
<dependency>
|
134
|
-
|
135
|
-
<groupId>org.springframework.boot</groupId>
|
136
|
-
|
137
|
-
<artifactId>spring-boot-devtools</artifactId>
|
138
|
-
|
139
|
-
<scope>runtime</scope>
|
140
|
-
|
141
|
-
<optional>true</optional>
|
142
|
-
|
143
|
-
</dependency>
|
144
|
-
|
145
|
-
<dependency>
|
146
|
-
|
147
|
-
<groupId>mysql</groupId>
|
148
|
-
|
149
|
-
<artifactId>mysql-connector-java</artifactId>
|
150
|
-
|
151
|
-
<scope>runtime</scope>
|
152
|
-
|
153
|
-
</dependency>
|
154
|
-
|
155
|
-
<dependency>
|
156
|
-
|
157
|
-
<groupId>org.springframework.boot</groupId>
|
158
|
-
|
159
|
-
<artifactId>spring-boot-starter-tomcat</artifactId>
|
160
|
-
|
161
|
-
<scope>provided</scope>
|
162
|
-
|
163
|
-
</dependency>
|
164
|
-
|
165
|
-
<dependency>
|
166
|
-
|
167
|
-
<groupId>org.springframework.boot</groupId>
|
168
|
-
|
169
|
-
<artifactId>spring-boot-starter-test</artifactId>
|
170
|
-
|
171
|
-
<scope>test</scope>
|
172
|
-
|
173
|
-
</dependency>
|
174
|
-
|
175
|
-
</dependencies>
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
<build>
|
180
|
-
|
181
|
-
<plugins>
|
182
|
-
|
183
|
-
<plugin>
|
184
|
-
|
185
|
-
<groupId>org.springframework.boot</groupId>
|
186
|
-
|
187
|
-
<artifactId>spring-boot-maven-plugin</artifactId>
|
188
|
-
|
189
|
-
</plugin>
|
190
|
-
|
191
|
-
</plugins>
|
192
|
-
|
193
|
-
</build>
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
</project>
|
198
|
-
|
199
|
-
|
200
214
|
|
201
215
|
```
|
202
216
|
|
203
|
-
```application.properties
|
204
|
-
|
205
|
-
spring.datasource.url=jdbc:mysql://localhost:3306/testdb?characterEncoding=UTF-8&serverTimezone=JST
|
206
|
-
|
207
|
-
spring.datasource.username=*****
|
208
|
-
|
209
|
-
spring.datasource.password=*****
|
210
|
-
|
211
|
-
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
212
|
-
|
213
|
-
```
|
214
|
-
|
215
217
|
### 試したこと
|
216
218
|
|
217
219
|
mysqlの3306ポート開放
|
3
エラーメッセージ
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,13 +28,19 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
-
|
31
|
+
Tue Apr 20 13:38:27 JST 2021
|
32
32
|
|
33
33
|
There was an unexpected error (type=Internal Server Error, status=500).
|
34
34
|
|
35
|
-
Could not open JDBC Connection for transaction; nested exception is java.sql.SQL
|
36
|
-
|
37
|
-
org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQL
|
35
|
+
Could not open JDBC Connection for transaction; nested exception is java.sql.SQLSyntaxErrorException: Unknown database 'localhost:3306/testdb'
|
36
|
+
|
37
|
+
org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLSyntaxErrorException: Unknown database 'localhost:3306/testdb'
|
38
|
+
|
39
|
+
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:309)
|
40
|
+
|
41
|
+
at org.springframework.transaction.support.AbstractPlatformTransactionManager.startTransaction(AbstractPlatformTransactionManager.java:400)
|
42
|
+
|
43
|
+
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
|
38
44
|
|
39
45
|
以下省略
|
40
46
|
|
2
タイトル
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
spring boot
|
1
|
+
spring bootからデータベースに接続できない問題を解決したい
|
test
CHANGED
File without changes
|
1
試したことを更新しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
spring tool 4
|
16
16
|
|
17
|
-
mysql
|
17
|
+
mysql8.0
|
18
18
|
|
19
19
|
### 発生している問題・エラーメッセージ
|
20
20
|
|
@@ -208,7 +208,7 @@
|
|
208
208
|
|
209
209
|
### 試したこと
|
210
210
|
|
211
|
-
|
211
|
+
mysqlの3306ポート開放
|
212
212
|
|
213
213
|
|
214
214
|
|