質問編集履歴

6

試したこと追加しました。

2019/08/09 06:09

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -534,7 +534,9 @@
534
534
 
535
535
 
536
536
 
537
-
537
+ Clean
538
+
539
+ →特に変化無し。
538
540
 
539
541
 
540
542
 

5

コードとキャプチャを追加しました。

2019/08/09 06:09

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,6 @@
1
+ ![プロジェクトに発生している!](f7ffd5a20c40fbea3f290f738b59c744.png)
2
+
1
- ### 前提・実現したいこと
3
+ ### トラブル内容
2
4
 
3
5
 
4
6
 
@@ -36,23 +38,459 @@
36
38
 
37
39
 
38
40
 
41
+
42
+
43
+
44
+
39
45
  を記載したところで、プロジェクトにビックリマークのようなものがついて、
40
46
 
41
47
  プロジェクトをビルドすると
42
48
 
43
-
44
-
45
- 「メイン・クラスが見つかりません」というような旨のエラーが出てしまいます。
46
-
47
-
49
+ コンソールに以下のようなメッセージが出てきてエラーになってしまいます。
50
+
51
+
52
+
53
+ エラー
54
+
55
+ ---
56
+
57
+ 2019-08-09 14:35:13.469 INFO 9372 --- [ main] c.t.springboot.MyBootAppApplication : Starting MyBootAppApplication on NAOKI-PC with PID 9372 (C:\Users\Naoki\Documents\workspace-sts-3.9.2.RELEASE\MyBootApp\target\classes started by Naoki in C:\Users\Naoki\Documents\workspace-sts-3.9.2.RELEASE\MyBootApp)
58
+
59
+ 2019-08-09 14:35:13.485 INFO 9372 --- [ main] c.t.springboot.MyBootAppApplication : No active profile set, falling back to default profiles: default
60
+
61
+ 2019-08-09 14:35:14.346 INFO 9372 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
62
+
63
+ 2019-08-09 14:35:14.409 INFO 9372 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 63ms. Found 1 repository interfaces.
64
+
65
+ 2019-08-09 14:35:14.774 INFO 9372 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$a8474ab6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
66
+
67
+ 2019-08-09 14:35:15.143 INFO 9372 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
68
+
69
+ 2019-08-09 14:35:15.177 INFO 9372 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
70
+
71
+ 2019-08-09 14:35:15.177 INFO 9372 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.17]
72
+
73
+ 2019-08-09 14:35:15.318 INFO 9372 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
74
+
75
+ 2019-08-09 14:35:15.333 INFO 9372 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1785 ms
76
+
77
+ 2019-08-09 14:35:15.411 WARN 9372 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
78
+
79
+ 2019-08-09 14:35:15.424 INFO 9372 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
80
+
81
+ 2019-08-09 14:35:15.440 INFO 9372 --- [ main] ConditionEvaluationReportLoggingListener :
82
+
83
+
84
+
85
+ Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
86
+
87
+ 2019-08-09 14:35:15.440 ERROR 9372 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
88
+
89
+
90
+
91
+ ***************************
92
+
93
+ APPLICATION FAILED TO START
94
+
95
+ ***************************
96
+
97
+
98
+
99
+ Description:
100
+
101
+
102
+
103
+ Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
104
+
105
+
106
+
107
+ Reason: Failed to determine a suitable driver class
108
+
109
+
110
+
111
+
112
+
113
+ Action:
114
+
115
+
116
+
117
+ Consider the following:
118
+
119
+ If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
120
+
121
+ If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
122
+
123
+
124
+
125
+ ---
48
126
 
49
127
  すみません、初学者すぎて質問の仕方もボヤッとしてますが、宜しくお願い致します。
50
128
 
51
129
 
52
130
 
53
-
131
+ 各ファイルは以下の通りです。
132
+
133
+
134
+
54
-
135
+ pom.xml
136
+
55
-
137
+ ```xml
138
+
139
+ <?xml version="1.0" encoding="UTF-8"?>
140
+
141
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
142
+
143
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
144
+
145
+ <modelVersion>4.0.0</modelVersion>
146
+
147
+ <parent>
148
+
149
+ <groupId>org.springframework.boot</groupId>
150
+
151
+ <artifactId>spring-boot-starter-parent</artifactId>
152
+
153
+ <version>2.1.4.RELEASE</version>
154
+
155
+ <relativePath/> <!-- lookup parent from repository -->
156
+
157
+ </parent>
158
+
159
+ <groupId>com.tsunano.springboot</groupId>
160
+
161
+ <artifactId>MyBootApp</artifactId>
162
+
163
+ <version>0.0.1-SNAPSHOT</version>
164
+
165
+ <name>MyBootApp</name>
166
+
167
+ <description>Sample project for Spring Boot</description>
168
+
169
+
170
+
171
+ <properties>
172
+
173
+
174
+
175
+ <java.version>1.8</java.version>
176
+
177
+ </properties>
178
+
179
+
180
+
181
+ <dependencies>
182
+
183
+
184
+
185
+ <dependency>
186
+
187
+ <groupId>org.springframework.boot</groupId>
188
+
189
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
190
+
191
+ </dependency>
192
+
193
+
194
+
195
+ <dependency>
196
+
197
+ <groupId>com.h2database</groupId>
198
+
199
+ <artifactId>h2</artifactId>
200
+
201
+ </dependency>
202
+
203
+
204
+
205
+ <dependency>
206
+
207
+ <groupId>org.springframework.boot</groupId>
208
+
209
+ <artifactId>spring-boot-starter-web</artifactId>
210
+
211
+ </dependency>
212
+
213
+
214
+
215
+ <dependency>
216
+
217
+ <groupId>org.springframework.boot</groupId>
218
+
219
+ <artifactId>spring-boot-starter-test</artifactId>
220
+
221
+ <scope>test</scope>
222
+
223
+ </dependency>
224
+
225
+ <dependency>
226
+
227
+ <groupId>org.springframework.boot</groupId>
228
+
229
+ <artifactId>spring-boot-starter-thymeleaf</artifactId>
230
+
231
+ </dependency>
232
+
233
+ </dependencies>
234
+
235
+
236
+
237
+ <build>
238
+
239
+ <plugins>
240
+
241
+ <plugin>
242
+
243
+ <groupId>org.springframework.boot</groupId>
244
+
245
+ <artifactId>spring-boot-maven-plugin</artifactId>
246
+
247
+ </plugin>
248
+
249
+ </plugins>
250
+
251
+ </build>
252
+
253
+
254
+
255
+ </project>
256
+
257
+
258
+
259
+ ```
260
+
261
+
262
+
263
+ HeloController.java
264
+
265
+ ```java
266
+
267
+ package com.tsunano.springboot;
268
+
269
+
270
+
271
+ import org.springframework.beans.factory.annotation.Autowired;
272
+
273
+ import org.springframework.stereotype.Controller;
274
+
275
+ import org.springframework.web.bind.annotation.RequestMapping;
276
+
277
+ import org.springframework.web.servlet.ModelAndView;
278
+
279
+
280
+
281
+ import com.tsunano.springboot.repositories.MyDataRepository;
282
+
283
+
284
+
285
+
286
+
287
+ @Controller
288
+
289
+ public class HeloController {
290
+
291
+
292
+
293
+ @Autowired
294
+
295
+ MyDataRepository repository;
296
+
297
+
298
+
299
+ @RequestMapping("/")
300
+
301
+ public ModelAndView index(ModelAndView mav) {
302
+
303
+ mav.setViewName("index");
304
+
305
+ mav.addObject("msg","this is sample content.");
306
+
307
+ Iterable<MyData> list=repository.findAll();
308
+
309
+ mav.addObject("data",list);
310
+
311
+ return mav;
312
+
313
+
314
+
315
+ }
316
+
317
+
318
+
319
+ }
320
+
321
+
322
+
323
+ ```
324
+
325
+
326
+
327
+ MyBootAppApplication.java
328
+
329
+ ```java
330
+
331
+ package com.tsunano.springboot;
332
+
333
+
334
+
335
+ import org.springframework.boot.SpringApplication;
336
+
337
+ import org.springframework.boot.autoconfigure.SpringBootApplication;
338
+
339
+
340
+
341
+ @SpringBootApplication
342
+
343
+ public class MyBootAppApplication {
344
+
345
+
346
+
347
+ public static void main(String[] args) {
348
+
349
+ SpringApplication.run(MyBootAppApplication.class, args);
350
+
351
+ }
352
+
353
+
354
+
355
+ }
356
+
357
+
358
+
359
+ ```
360
+
361
+
362
+
363
+ MyData.java
364
+
365
+ ```java
366
+
367
+ package com.tsunano.springboot;
368
+
369
+
370
+
371
+
372
+
373
+ import javax.persistence.Column;
374
+
375
+ import javax.persistence.Entity;
376
+
377
+ import javax.persistence.GeneratedValue;
378
+
379
+ import javax.persistence.GenerationType;
380
+
381
+ import javax.persistence.Id;
382
+
383
+ import javax.persistence.Table;
384
+
385
+
386
+
387
+ @Entity
388
+
389
+ @Table(name="mydata")
390
+
391
+
392
+
393
+ public class MyData {
394
+
395
+
396
+
397
+
398
+
399
+ @Id
400
+
401
+ @GeneratedValue(strategy=GenerationType.AUTO)
402
+
403
+ @Column
404
+
405
+ private long id;
406
+
407
+
408
+
409
+ @Column(length=50, nullable=false)
410
+
411
+ private String name;
412
+
413
+
414
+
415
+ @Column(length=200, nullable=true)
416
+
417
+ private String mail;
418
+
419
+
420
+
421
+ @Column(nullable=true)
422
+
423
+ private Integer age;
424
+
425
+
426
+
427
+ @Column(nullable=true)
428
+
429
+ private String memo;
430
+
431
+
432
+
433
+
434
+
435
+ public long getId() {return id;}
436
+
437
+ public void setId(long id) {this.id=id;}
438
+
439
+ public String getName() {return name;}
440
+
441
+ public void setName(String name) {this.name=name;}
442
+
443
+ public String getMail() {return mail;}
444
+
445
+ public void setMail(String mail) {this.mail=mail;}
446
+
447
+ public Integer getAge() {return age;}
448
+
449
+ public void setAge(Integer age) {this.age=age;}
450
+
451
+ public String getMemo() {return memo;}
452
+
453
+ public void setMemo(String memo) {this.memo=memo;}
454
+
455
+ }
456
+
457
+ ```
458
+
459
+
460
+
461
+
462
+
463
+ MyDataRepository.java
464
+
465
+ ```java
466
+
467
+ package com.tsunano.springboot.repositories;
468
+
469
+
470
+
471
+
472
+
473
+ import com.tsunano.springboot.MyData;
474
+
475
+
476
+
477
+ import org.springframework.data.jpa.repository.JpaRepository;
478
+
479
+ import org.springframework.stereotype.Repository;
480
+
481
+
482
+
483
+ @Repository
484
+
485
+ public interface MyDataRepository extends JpaRepository<MyData,Long> {
486
+
487
+
488
+
489
+ }
490
+
491
+
492
+
493
+ ```
56
494
 
57
495
 
58
496
 
@@ -64,13 +502,13 @@
64
502
 
65
503
 
66
504
 
67
- application.propatiesにDBへの接続情報を記載。
505
+ application.propatiesにDBへの接続情報を記載。
68
506
 
69
507
  →特に変化無し。
70
508
 
71
509
 
72
510
 
73
- pom.xmlの書き換え
511
+ pom.xmlの書き換え
74
512
 
75
513
  ```lang-xml
76
514
 
@@ -90,12 +528,14 @@
90
528
 
91
529
 
92
530
 
93
- プロジェクトを右クリック→Maven→Update Project
531
+ プロジェクトを右クリック→Maven→Update Project
94
532
 
95
533
  →特に変化無し。
96
534
 
97
535
 
98
536
 
537
+
538
+
99
539
 
100
540
 
101
541
 

4

試したこと追加

2019/08/09 05:59

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -92,7 +92,7 @@
92
92
 
93
93
  ③プロジェクトを右クリック→Maven→Update Project
94
94
 
95
-
95
+ →特に変化無し。
96
96
 
97
97
 
98
98
 

3

試したこと追加

2019/08/09 03:00

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -90,6 +90,10 @@
90
90
 
91
91
 
92
92
 
93
+ ③プロジェクトを右クリック→Maven→Update Project
94
+
95
+
96
+
93
97
 
94
98
 
95
99
 

2

Markdown使用

2019/08/09 03:00

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -11,6 +11,8 @@
11
11
 
12
12
 
13
13
  pom.xmlに
14
+
15
+ ```lang-xml
14
16
 
15
17
  <dependency>
16
18
 
@@ -27,6 +29,10 @@
27
29
  <artifactId>h2</artifactId>
28
30
 
29
31
  </dependency>
32
+
33
+ ```
34
+
35
+
30
36
 
31
37
 
32
38
 
@@ -66,6 +72,8 @@
66
72
 
67
73
  ②pom.xmlの書き換え
68
74
 
75
+ ```lang-xml
76
+
69
77
  <dependency>
70
78
 
71
79
  <groupId>org.hsqldb</groupId>
@@ -73,6 +81,8 @@
73
81
  <artifactId>hsqldb</artifactId>
74
82
 
75
83
  </dependency>
84
+
85
+ ```
76
86
 
77
87
  →ビックリマークは消えました。
78
88
 

1

試したことを追記しました。また、追加の質問も記載しました。

2019/08/09 02:11

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -46,11 +46,43 @@
46
46
 
47
47
 
48
48
 
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
49
57
  ### 試したこと
50
58
 
51
59
 
52
60
 
53
- application.propatiesにDBへの接続情報を記載。
61
+ application.propatiesにDBへの接続情報を記載。
62
+
63
+ →特に変化無し。
64
+
65
+
66
+
67
+ ②pom.xmlの書き換え
68
+
69
+ <dependency>
70
+
71
+ <groupId>org.hsqldb</groupId>
72
+
73
+ <artifactId>hsqldb</artifactId>
74
+
75
+ </dependency>
76
+
77
+ →ビックリマークは消えました。
78
+
79
+ そもそもHSQLDBをインストールしていないので、意味がないです。
80
+
81
+
82
+
83
+
84
+
85
+
54
86
 
55
87
 
56
88