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

質問編集履歴

2

pom\.xmlの中身を追加

2017/06/29 12:12

投稿

Linkey
Linkey

スコア77

title CHANGED
File without changes
body CHANGED
@@ -11,89 +11,11 @@
11
11
  ![イメージ説明](ea3b464fa965f47b4f654988df58d2b3.png)
12
12
 
13
13
  サーブレット
14
- ```java
15
- package registration.servlet;
14
+ ![イメージ説明](2211203838e67ef2bb0cf1a9c9194970.png)
15
+ ![イメージ説明](83279df01513ca65176cb7d626366e45.png)
16
+ ![イメージ説明](5fc5d62105bb27f5e525d7023b6935df.png)
17
+ ![イメージ説明](2e4a2972fa0512898004c975e991f91b.png)
16
18
 
17
- import java.io.IOException;
18
- import java.io.InputStream;
19
- import java.util.Properties;
20
-
21
- import javax.servlet.ServletException;
22
- import javax.servlet.http.HttpServlet;
23
- import javax.servlet.http.HttpServletRequest;
24
- import javax.servlet.http.HttpServletResponse;
25
-
26
- import registration.controller.RegistrationController;
27
- import util.exception.UnexpectedProcessingException;
28
- import util.servlet.ServletResource;
29
- import util.util.OutputLogger;
30
-
31
- public class RegistrationServlet extends HttpServlet implements ServletResource{
32
- private static final long serialVersionUID = 1L;
33
- private final static String COMMON_URL = "CommonUrl";
34
- private final static String PROPERTY_FILE = "url.properties";
35
- private final static Properties prop = new Properties();
36
- private final static String API_NAME = "RegistrationServlet";
37
-
38
- // 初期化処理を行います
39
- public void init() throws ServletException{
40
-
41
- InputStream inStream = null;
42
- OutputLogger Logger = new OutputLogger();
43
- StackTraceElement throwableStackTraceElement = null;
44
- String outputInfoLogLine = null;
45
- try {
46
- throwableStackTraceElement = new Throwable().getStackTrace()[0];
47
- outputInfoLogLine = Logger.generateOutputInfoLogInfo(throwableStackTraceElement, 2);
48
- //logger.info("[プロパティファイル読込開始] ({})", outputInfoLogLine);
49
- throwableStackTraceElement = null;
50
- inStream = RegistrationServlet.class.getClassLoader().getResourceAsStream(PROPERTY_FILE);
51
- prop.load(inStream);
52
- } catch (IOException e) {
53
- Logger.generateOutputWarnLogInfo(API_NAME, e);
54
- gotoErrorPage("プロパティ読込エラー");
55
- } catch (NullPointerException e) {
56
- //TODO ログにipアドレスを出力するかどうか検討中
57
- System.out.println("NullPointerExceptionが発生");
58
- Logger.generateOutputWarnLogInfo(API_NAME, e);
59
- gotoErrorPage("プロパティファイル未存在");
60
- } finally {
61
- try {
62
- if (inStream != null) {
63
- inStream.close();
64
- }
65
- throwableStackTraceElement = new Throwable().getStackTrace()[0];
66
- outputInfoLogLine = Logger.generateOutputInfoLogInfo(throwableStackTraceElement, 2);
67
- } catch (IOException e) {
68
- Logger.generateOutputWarnLogInfo(API_NAME, e);
69
- }
70
- }
71
- }
72
-
73
- protected void doGet(HttpServletRequest request, HttpServletResponse response)
74
- throws ServletException, IOException {
75
- //初回の処理(会員登録ボタン〜利用規約同意画面は特にJSONデータは必要なし)
76
-
77
- // パラメータを取得する(DecidedResistration)
78
- String process_code = request.getParameter("process_name");
79
-
80
- // コントローラを呼び出す
81
- RegistrationController rc = new RegistrationController();
82
- rc.invoke(process_code);
83
-
84
- }
85
-
86
- protected void doPost(HttpServletRequest request, HttpServletResponse response)
87
- throws ServletException, IOException {
88
- //TODO 未実装
89
- }
90
-
91
- @Override
92
- public void gotoErrorPage(String errorMessage) {
93
- throw new UnexpectedProcessingException(errorMessage);
94
- }
95
- }
96
- ```
97
19
  コントローラークラス
98
20
  ![イメージ説明](6c82159fa5d6aef25606e65a67c92040.png)
99
21
 
@@ -299,10 +221,128 @@
299
221
  ```
300
222
 
301
223
  pom.xmlの中身
224
+ ```xml
225
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
226
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
302
- ![その1](1963d6438438c636eb436dca58ae2427.png)
227
+ <modelVersion>4.0.0</modelVersion>
228
+ <groupId>com.sample.mvnproject</groupId>
229
+ <artifactId>java-restaurant</artifactId>
303
- ![その2](73a04316751bd740e4c29950b03c9811.png)
230
+ <packaging>war</packaging>
231
+ <version>0.0.1-SNAPSHOT</version>
232
+ <name>java-restaurant Maven Webapp</name>
233
+ <url>http://maven.apache.org</url>
234
+ <properties>
235
+ <hibernate.version>4.3.10.Final</hibernate.version>
236
+ </properties>
237
+ <dependencies>
238
+ <dependency>
239
+ <groupId>junit</groupId>
240
+ <artifactId>junit</artifactId>
241
+ <version>3.8.1</version>
242
+ <scope>test</scope>
243
+ </dependency>
244
+ <!-- added servlet info -->
245
+ <dependency>
246
+ <groupId>javax.servlet</groupId>
247
+ <artifactId>javax.servlet-api</artifactId>
248
+ <version>3.1.0</version>
249
+ </dependency>
250
+ <!-- added JSP info -->
251
+ <dependency>
252
+ <groupId>javax.servlet</groupId>
253
+ <artifactId>jstl</artifactId>
254
+ <version>1.2</version>
255
+ </dependency>
256
+ <!-- added JSTL info -->
257
+ <dependency>
258
+ <groupId>javax.servlet.jsp</groupId>
259
+ <artifactId>javax.servlet.jsp-api</artifactId>
260
+ <version>2.3.1</version>
261
+ </dependency>
262
+ <!-- added mockit for ut -->
263
+ <dependency>
304
- ![その3](85f34fbe66e332c8ea12d6ab716cc9d0.png)
264
+ <groupId>org.mockito</groupId>
265
+ <artifactId>mockito-all</artifactId>
266
+ <version>1.9.5</version>
267
+ </dependency>
268
+ <!-- added Hibernate info -->
269
+ <dependency>
270
+ <groupId>org.hibernate</groupId>
271
+ <artifactId>hibernate-annotations</artifactId>
272
+ <version>3.5.6-Final</version>
273
+ </dependency>
274
+ <dependency>
275
+ <groupId>org.hibernate</groupId>
276
+ <artifactId>hibernate-core</artifactId>
305
- ![その4](0c47cb5a215d10f5ce0e599d2244b23e.png)
277
+ <version>5.2.10.Final</version>
278
+ </dependency>
279
+ <dependency>
280
+ <groupId>org.eclipse.persistence</groupId>
281
+ <artifactId>org.eclipse.persistence.jpa</artifactId>
282
+ <version>2.6.4</version>
283
+ </dependency>
284
+ <dependency>
285
+ <groupId>org.springframework</groupId>
286
+ <artifactId>spring-webmvc</artifactId>
287
+ <version>4.3.8.RELEASE</version>
288
+ </dependency>
289
+ <!-- added MySQL Connector Info -->
290
+ <dependency>
291
+ <groupId>mysql</groupId>
292
+ <artifactId>mysql-connector-java</artifactId>
293
+ <version>5.1.42</version>
294
+ </dependency>
295
+ <!-- added log4j info -->
296
+ <dependency>
297
+ <groupId>org.apache.logging.log4j</groupId>
298
+ <artifactId>log4j-core</artifactId>
299
+ <version>2.7</version>
300
+ </dependency>
301
+ <dependency>
302
+ <groupId>org.apache.logging.log4j</groupId>
303
+ <artifactId>log4j-api</artifactId>
304
+ <version>2.7</version>
305
+ </dependency>
306
+ <dependency>
307
+ <groupId>org.hibernate.javax.persistence</groupId>
308
+ <artifactId>hibernate-jpa-2.1-api</artifactId>
309
+ <version>1.0.0.Final</version>
310
+ </dependency>
311
+ <!-- added jBcrypt -->
312
+ <dependency>
313
+ <groupId>org.mindrot</groupId>
314
+ <artifactId>jbcrypt</artifactId>
315
+ <version>0.4</version>
316
+ </dependency>
317
+ <!-- persistence -->
318
+ </dependencies>
319
+ <build>
320
+ <finalName>java-restaurant</finalName>
321
+ <plugins>
322
+ <plugin>
323
+ <groupId>org.apache.maven.plugins</groupId>
324
+ <artifactId>maven-compiler-plugin</artifactId>
325
+ <version>3.1</version>
326
+ <configuration>
327
+ <source>1.8</source>
328
+ <target>1.8</target>
329
+ <encoding>UTF-8</encoding>
330
+ </configuration>
331
+ </plugin>
306
- ![その5](fd3dfff76fbfe666caa6a3154c12b60a.png)
332
+ <!-- added tomcat maven plugin info -->
333
+ <plugin>
334
+ <groupId>org.apache.tomcat.maven</groupId>
335
+ <artifactId>tomcat7-maven-plugin</artifactId>
336
+ <version>2.2</version>
337
+ <configuration>
338
+ <path>/foo</path>
339
+ <server>tomcat-localhost</server>
340
+ <url>http://localhost:8080/manager/text</url>
341
+ </configuration>
342
+ </plugin>
343
+ </plugins>
344
+ </build>
345
+ </project>
346
+ ```
307
347
 
308
348
  JPA、Hibernateにお詳しい方がいましたら、または原因に当たりがついた方がいらっしゃいましたらご回答をお願いいたします。

1

pom\.xmlの中身を追加

2017/06/29 12:11

投稿

Linkey
Linkey

スコア77

title CHANGED
File without changes
body CHANGED
@@ -298,4 +298,11 @@
298
298
  }
299
299
  ```
300
300
 
301
+ pom.xmlの中身
302
+ ![その1](1963d6438438c636eb436dca58ae2427.png)
303
+ ![その2](73a04316751bd740e4c29950b03c9811.png)
304
+ ![その3](85f34fbe66e332c8ea12d6ab716cc9d0.png)
305
+ ![その4](0c47cb5a215d10f5ce0e599d2244b23e.png)
306
+ ![その5](fd3dfff76fbfe666caa6a3154c12b60a.png)
307
+
301
308
  JPA、Hibernateにお詳しい方がいましたら、または原因に当たりがついた方がいらっしゃいましたらご回答をお願いいたします。