質問編集履歴

5

エラーメッセージ修正

2019/02/20 02:25

投稿

arufa86
arufa86

スコア19

test CHANGED
File without changes
test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Beansを読み込む時に以下のエラーが発生するので解決したい。
6
6
 
7
- (おそらくEntityManagerFactoryが読み込めない)
7
+
8
8
 
9
9
  ### 発生している問題・エラーメッセージ
10
10
 
@@ -12,11 +12,11 @@
12
12
 
13
13
  ```
14
14
 
15
- Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EntityManagerFactory' defined in class path resource [dbbeans.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/context/index/![CandidateComponentsIndexLoader]
15
+ Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EntityManagerFactory' defined in class path resource [dbbeans.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/context/index/CandidateComponentsIndexLoader
16
16
 
17
17
  ```
18
18
 
19
-
19
+ (org/springframework/context/index/CandidateComponentsIndexLoaderが読み込めない)
20
20
 
21
21
  ### 該当のソースコード
22
22
 

4

classPath修正

2019/02/20 02:25

投稿

arufa86
arufa86

スコア19

test CHANGED
File without changes
test CHANGED
@@ -490,7 +490,11 @@
490
490
 
491
491
 
492
492
 
493
- classPath: C:\Users\(ユーザー名)\Documents\eclipse Spring\pleiades\tomcat\8\bin\bootstrap.jar;C:\Users\omega\Documents\eclipse Spring\pleiades\tomcat\8\bin\tomcat-juli.jar;C:\Users\omega\Documents\eclipse Spring\pleiades\java\8\lib\tools.jar
493
+ classPath: C:\Users\(ユーザー名)\Documents\eclipse Spring\pleiades\tomcat\8\bin\bootstrap.jar;
494
+
495
+ C:\Users\omega\Documents\eclipse Spring\pleiades\tomcat\8\bin\tomcat-juli.jar;
496
+
497
+ C:\Users\omega\Documents\eclipse Spring\pleiades\java\8\lib\tools.jar
494
498
 
495
499
 
496
500
 

3

クラスパス、エディタ情報、ファイル構成追加

2019/02/20 02:16

投稿

arufa86
arufa86

スコア19

test CHANGED
File without changes
test CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  ```
14
14
 
15
- Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EntityManagerFactory' defined in class path resource [dbbeans.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/context/index/CandidateComponentsIndexLoader
15
+ Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EntityManagerFactory' defined in class path resource [dbbeans.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/context/index/![CandidateComponentsIndexLoader]
16
16
 
17
17
  ```
18
18
 
@@ -487,3 +487,17 @@
487
487
  Spring 4.3.7.RELEASE
488
488
 
489
489
  spring-data-jpa 2.1.5.RELEASE
490
+
491
+
492
+
493
+ classPath: C:\Users\(ユーザー名)\Documents\eclipse Spring\pleiades\tomcat\8\bin\bootstrap.jar;C:\Users\omega\Documents\eclipse Spring\pleiades\tomcat\8\bin\tomcat-juli.jar;C:\Users\omega\Documents\eclipse Spring\pleiades\java\8\lib\tools.jar
494
+
495
+
496
+
497
+ エディタ:eclipse Mars
498
+
499
+
500
+
501
+ ファイル構成:
502
+
503
+ ![イメージ説明](a1eb42e9f2a1f8b633f7978613b74faf.png)

2

pom.xml追加

2019/02/20 02:13

投稿

arufa86
arufa86

スコア19

test CHANGED
File without changes
test CHANGED
@@ -20,9 +20,9 @@
20
20
 
21
21
  ### 該当のソースコード
22
22
 
23
-
24
-
25
- ```dbbeans.xml
23
+ dbbeans
24
+
25
+ ``` xml
26
26
 
27
27
  <?xml version="1.0" encoding="UTF-8"?>
28
28
 
@@ -88,6 +88,388 @@
88
88
 
89
89
  ```
90
90
 
91
+
92
+
93
+ pom.xml
94
+
95
+ ``` xml
96
+
97
+ <?xml version="1.0" encoding="UTF-8"?>
98
+
99
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
100
+
101
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
102
+
103
+ <modelVersion>4.0.0</modelVersion>
104
+
105
+ <groupId>com.company</groupId>
106
+
107
+ <artifactId>sample</artifactId>
108
+
109
+ <name>mvcSample</name>
110
+
111
+ <packaging>war</packaging>
112
+
113
+ <version>1.0.0-BUILD-SNAPSHOT</version>
114
+
115
+
116
+
117
+
118
+
119
+ <properties>
120
+
121
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
122
+
123
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
124
+
125
+ <java-version>1.8</java-version>
126
+
127
+ <org.springframework-version>4.3.7.RELEASE</org.springframework-version>
128
+
129
+ <org.aspectj-version> 1.8.10</org.aspectj-version>
130
+
131
+ <org.slf4j-version>1.7.24</org.slf4j-version>
132
+
133
+ </properties>
134
+
135
+ <dependencies>
136
+
137
+ <!-- Spring -->
138
+
139
+ <dependency>
140
+
141
+ <groupId>org.springframework</groupId>
142
+
143
+ <artifactId>spring-context</artifactId>
144
+
145
+ <version>${org.springframework-version}</version>
146
+
147
+ <exclusions>
148
+
149
+ <!-- Exclude Commons Logging in favor of SLF4j -->
150
+
151
+ <exclusion>
152
+
153
+ <groupId>commons-logging</groupId>
154
+
155
+ <artifactId>commons-logging</artifactId>
156
+
157
+ </exclusion>
158
+
159
+ </exclusions>
160
+
161
+ </dependency>
162
+
163
+ <dependency>
164
+
165
+ <groupId>mysql</groupId>
166
+
167
+ <artifactId>mysql-connector-java</artifactId>
168
+
169
+ <version>8.0.15</version>
170
+
171
+ </dependency>
172
+
173
+ <dependency>
174
+
175
+ <groupId>org.springframework</groupId>
176
+
177
+ <artifactId>spring-jdbc</artifactId>
178
+
179
+ <version>${org.springframework-version}</version>
180
+
181
+ </dependency>
182
+
183
+ <dependency>
184
+
185
+ <groupId>org.springframework.data</groupId>
186
+
187
+ <artifactId>spring-data-jpa</artifactId>
188
+
189
+ <version>2.1.5.RELEASE</version>
190
+
191
+ </dependency>
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+ <dependency>
200
+
201
+ <groupId>org.springframework</groupId>
202
+
203
+ <artifactId>spring-webmvc</artifactId>
204
+
205
+ <version>${org.springframework-version}</version>
206
+
207
+ </dependency>
208
+
209
+
210
+
211
+ <!-- AspectJ -->
212
+
213
+ <dependency>
214
+
215
+ <groupId>org.aspectj</groupId>
216
+
217
+ <artifactId>aspectjrt</artifactId>
218
+
219
+ <version>${org.aspectj-version}</version>
220
+
221
+ </dependency>
222
+
223
+
224
+
225
+ <!-- Logging -->
226
+
227
+ <dependency>
228
+
229
+ <groupId>org.slf4j</groupId>
230
+
231
+ <artifactId>slf4j-api</artifactId>
232
+
233
+ <version>${org.slf4j-version}</version>
234
+
235
+ </dependency>
236
+
237
+ <dependency>
238
+
239
+ <groupId>org.slf4j</groupId>
240
+
241
+ <artifactId>jcl-over-slf4j</artifactId>
242
+
243
+ <version>${org.slf4j-version}</version>
244
+
245
+ <scope>runtime</scope>
246
+
247
+ </dependency>
248
+
249
+ <dependency>
250
+
251
+ <groupId>org.slf4j</groupId>
252
+
253
+ <artifactId>slf4j-log4j12</artifactId>
254
+
255
+ <version>${org.slf4j-version}</version>
256
+
257
+ <scope>runtime</scope>
258
+
259
+ </dependency>
260
+
261
+ <dependency>
262
+
263
+ <groupId>log4j</groupId>
264
+
265
+ <artifactId>log4j</artifactId>
266
+
267
+ <version>1.2.15</version>
268
+
269
+ <exclusions>
270
+
271
+ <exclusion>
272
+
273
+ <groupId>javax.mail</groupId>
274
+
275
+ <artifactId>mail</artifactId>
276
+
277
+ </exclusion>
278
+
279
+ <exclusion>
280
+
281
+ <groupId>javax.jms</groupId>
282
+
283
+ <artifactId>jms</artifactId>
284
+
285
+ </exclusion>
286
+
287
+ <exclusion>
288
+
289
+ <groupId>com.sun.jdmk</groupId>
290
+
291
+ <artifactId>jmxtools</artifactId>
292
+
293
+ </exclusion>
294
+
295
+ <exclusion>
296
+
297
+ <groupId>com.sun.jmx</groupId>
298
+
299
+ <artifactId>jmxri</artifactId>
300
+
301
+ </exclusion>
302
+
303
+ </exclusions>
304
+
305
+ <scope>runtime</scope>
306
+
307
+ </dependency>
308
+
309
+
310
+
311
+ <!-- @Inject -->
312
+
313
+ <dependency>
314
+
315
+ <groupId>javax.inject</groupId>
316
+
317
+ <artifactId>javax.inject</artifactId>
318
+
319
+ <version>1</version>
320
+
321
+ </dependency>
322
+
323
+
324
+
325
+ <!-- Servlet -->
326
+
327
+ <dependency>
328
+
329
+ <groupId>javax.servlet</groupId>
330
+
331
+ <artifactId>servlet-api</artifactId>
332
+
333
+ <version>2.5</version>
334
+
335
+ <scope>provided</scope>
336
+
337
+ </dependency>
338
+
339
+ <dependency>
340
+
341
+ <groupId>javax.servlet.jsp</groupId>
342
+
343
+ <artifactId>jsp-api</artifactId>
344
+
345
+ <version>2.1</version>
346
+
347
+ <scope>provided</scope>
348
+
349
+ </dependency>
350
+
351
+ <dependency>
352
+
353
+ <groupId>javax.servlet</groupId>
354
+
355
+ <artifactId>jstl</artifactId>
356
+
357
+ <version>1.2</version>
358
+
359
+ </dependency>
360
+
361
+ <dependency>
362
+
363
+ <groupId>org.hibernate</groupId>
364
+
365
+ <artifactId>hibernate-entitymanager</artifactId>
366
+
367
+ <version>5.3.7.Final</version>
368
+
369
+ </dependency>
370
+
371
+
372
+
373
+ <!-- Test -->
374
+
375
+ <dependency>
376
+
377
+ <groupId>junit</groupId>
378
+
379
+ <artifactId>junit</artifactId>
380
+
381
+ <version>4.7</version>
382
+
383
+ <scope>test</scope>
384
+
385
+ </dependency>
386
+
387
+ </dependencies>
388
+
389
+ <build>
390
+
391
+ <plugins>
392
+
393
+ <plugin>
394
+
395
+ <artifactId>maven-eclipse-plugin</artifactId>
396
+
397
+ <version>2.9</version>
398
+
399
+ <configuration>
400
+
401
+ <additionalProjectnatures>
402
+
403
+ <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
404
+
405
+ </additionalProjectnatures>
406
+
407
+ <additionalBuildcommands>
408
+
409
+ <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
410
+
411
+ </additionalBuildcommands>
412
+
413
+ <downloadSources>true</downloadSources>
414
+
415
+ <downloadJavadocs>true</downloadJavadocs>
416
+
417
+ </configuration>
418
+
419
+ </plugin>
420
+
421
+ <plugin>
422
+
423
+ <groupId>org.apache.maven.plugins</groupId>
424
+
425
+ <artifactId>maven-compiler-plugin</artifactId>
426
+
427
+ <version>2.5.1</version>
428
+
429
+ <configuration>
430
+
431
+ <source>1.8</source>
432
+
433
+ <target>1.8</target>
434
+
435
+ <encoding>UTF-8</encoding>
436
+
437
+ <compilerArgument>-Xlint:all</compilerArgument>
438
+
439
+ <showWarnings>true</showWarnings>
440
+
441
+ <showDeprecation>true</showDeprecation>
442
+
443
+ </configuration>
444
+
445
+ </plugin>
446
+
447
+ <plugin>
448
+
449
+ <groupId>org.codehaus.mojo</groupId>
450
+
451
+ <artifactId>exec-maven-plugin</artifactId>
452
+
453
+ <version>1.2.1</version>
454
+
455
+ <configuration>
456
+
457
+ <mainClass>org.test.int1.Main</mainClass>
458
+
459
+ </configuration>
460
+
461
+ </plugin>
462
+
463
+ </plugins>
464
+
465
+ </build>
466
+
467
+ </project>
468
+
469
+ ```
470
+
471
+
472
+
91
473
  ```Java
92
474
 
93
475
  ApplicationContext app = new ClassPathXmlApplicationContext(new String[]{"dbbeans.xml"});

1

Javaコード追加

2019/02/19 05:20

投稿

arufa86
arufa86

スコア19

test CHANGED
@@ -1 +1 @@
1
- Spring4Beans読み込みエラー
1
+ Spring4Beans読み込みエラーを解決したい
test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- Beansを読み込む時に以下のエラーが発生
5
+ Beansを読み込む時に以下のエラーが発生するので解決したい。
6
6
 
7
7
  (おそらくEntityManagerFactoryが読み込めない)
8
8
 
@@ -88,7 +88,11 @@
88
88
 
89
89
  ```
90
90
 
91
+ ```Java
91
92
 
93
+ ApplicationContext app = new ClassPathXmlApplicationContext(new String[]{"dbbeans.xml"});
94
+
95
+ ```
92
96
 
93
97
 
94
98