๋ฐ˜์‘ํ˜•
์ƒํ™ฉ

vagrant up ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜์—ฌ master node, worker node ๋“ฑ์„ ์‹คํ–‰ํ•˜๋ ค๊ณ  ํ•˜์˜€๋Š”๋ฐ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•จ.
(์ด์ฑ…์œผ๋กœ ํ•™์Šต์ค‘ ์ด์˜€๊ณ .., ๋‚˜๋Š” mac ์œ ์ €์˜€๋œธ..)

๊ตฌ๊ธ€๋ง์„ ํ•ด๋ณด๋‹ˆ VirtualBox ๋ฒ„์ „์„ ๋‹ค์šด๊ทธ๋ ˆ์ด๋“œ๋ฅผ ํ•ด์•ผํ•œ๋‹ค๋Š” ๋‚ด์šฉ๋“ฑ๋“ฑ ๋ฐœ๊ฒฌํ•˜๊ธดํ•˜์˜€๋œธ.. 

 

ํ•ด๊ฒฐ

private_network ์ •๋ณด๋ฅผ 192.168.1.10 ์—์„œ 192.168.56.10 ์œผ๋กœ ๋ณ€๊ฒฝํ•˜์—ฌ ์ ์šฉํ•˜์—ฌ ๋‹ค์‹œ ์‹คํ–‰ํ•˜์˜€๋”๋‹ˆ ์—๋Ÿฌ ๋ฐœ์ƒ ํ•˜์ง€ ์•Š๊ฒŒ๋จ.

๊ทธ๋ ‡๊ฒŒ ํ•œ ์ด์œ ๋Š” virtualbox ์‚ฌ์ดํŠธ ๊ด€๋ จ ๋ฌธ์„œ ๋‚ด์šฉ์ค‘์ด ์ด๋Ÿฌํ•œ ๋‚ด์šฉ์„ ๋ฐœ๊ฒฌํ–ˆ๊ธฐ ๋•Œ๋ฌธ..,
>> Linux, Mac OS X ๋ฐ Solaris Oracle VM VirtualBox๋Š” 192.168.56.0/21 ๋ฒ”์œ„์˜ IP ์ฃผ์†Œ๋งŒ ํ˜ธ์ŠคํŠธ ์ „์šฉ ์–ด๋Œ‘ํ„ฐ์— ํ• ๋‹นํ•˜๋„๋ก ํ—ˆ์šฉํ•œ๋‹ค๋Š” ๋‚ด์šฉ..

 


 

 

๋ฐ˜์‘ํ˜•
๋ฐ˜์‘ํ˜•
์ƒํ™ฉ

H2 db ์‚ฌ์šฉ, entity class ์— ํ…Œ์ด๋ธ”๋ช…์„ ๋ช…์‹œํ•ด์ฃผ์ง€ ์•Š์Œ. 
๋ฐ์ดํ„ฐ ๋“ฑ๋ก ์ฒ˜๋ฆฌ ์ค‘ ํ•ด๋‹น ์—๋Ÿฌ ๋ฐœ์ƒ (ํ…Œ์ด๋ธ” ์‹œํ€€์Šค ๊ฐ’์ด ์—†๋‹ค๋Š” ์ƒํ™ฉ)

 

ํ•ด๊ฒฐ

entity class (@Entity ์„ค์ • ํด๋ž˜์Šค) ๋‚ด id ํ•„๋“œ(@Id ์„ค์ •๋œ ๊ฐ’)์˜
@GeneratedValue(strategy = GenerationType.AUTO) ์„ค์ • ๋ถ€๋ถ„์„
@GeneratedValue(strategy = GenerationType.IDENTITY) ์œผ๋กœ ๋ณ€๊ฒฝ
    --> ๊ธฐ๋ณธํ‚ค ์ƒ์„ฑ์„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ์œ„์ž„ํ•ด์ฃผ๊ณ  id๊ฐ€ null ์ด๋ฉด ์•Œ์•„์„œ auto_increment ํ•ด์คŒ


์ฐธ๊ณ 

https://stackoverflow.com/questions/39807483/sequence-hibernate-sequence-not-found-sql-statement

 

Sequence "HIBERNATE_SEQUENCE" not found; SQL statement

In my spring mvc app, i have the following object. I am trying to make a visual of data using devtool in my app. @Entity @Data public class ConsultationRequest { @Id @GeneratedValue p...

stackoverflow.com

https://gmlwjd9405.github.io/2019/08/12/primary-key-mapping.html

๋ฐ˜์‘ํ˜•
๋ฐ˜์‘ํ˜•

ํ”„๋ก ํŠธ์—์„œ ๋ณด๋‚ด์ง€ ์•Š์€ ํŒŒ๋ผ๋ฏธํ„ฐ ๊ฐ’์„ ์„œ๋ฒ„์—์„œ ๋ฐ›์œผ๋ ค๊ณ  ํ• ๋•Œ ๋ฐœ์ƒ.

 

@RequestParam์˜ required ์—ฌ๋ถ€ ํ™•์ธ

ex. @RequestParam(value=“param”, required=false) MultipartFile param ....

๋กœ ์ •์˜ํ•˜๋ฉด param ์„ null๋กœ ๋ฐ›์„ ์ˆ˜ ์žˆ๋‹ค.

 

+ MultipartFile[]์˜ ๊ฒฝ์šฐ๋Š” ํ”„๋ก ํŠธ์—์„œ ๊ฐ’์„ ์•ˆ๋„˜๊ธฐ๋”๋ผ๋„

๊ธฐ๋ณธ ์ฃผ์†Œ(null ์ด ์•„๋‹Œ ๊ธฐ๋ณธ ๊ธธ์ด 0)๊ฐ€ ์กด์žฌํ•˜์—ฌ ํ•ด๋‹น์ƒํ™ฉ ๋ฐœ์ƒ ์•ˆํ•จ!

๋ฐ˜์‘ํ˜•
๋ฐ˜์‘ํ˜•

์‚ฌ์šฉ์ค‘์ธ ํฌํŠธ ํ™•์ธํ•„์š” -> ํฌํŠธ๋ฅผ ์ฃฝ์ด์„ธ์š”.

$ lost -I :ํฌํŠธ๋ฒˆํ˜ธ
COMMAND   PID       USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    24496 xxx   6u  IPv6 xxxx     0t0  TCP *:http-alt (LISTEN)

$ kill -9 PID (PID๋Š” 24496)

 

๋ฐ˜์‘ํ˜•
๋ฐ˜์‘ํ˜•

HTTP Status 500 - Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:


์—๋Ÿฌ๋‚จ (ใ… ใ… )

db๋ช… ์ž˜๋ชป๋˜์–ด์žˆ์–ด์„œ ๋‚ฌ์—ˆ์Œ... db๋ช… ๊ณ ์ณ์ฃผ๋‹ˆ ํ•ด๊ฒฐ!

...

root cause

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database '์ž˜๋ชป๋œDB๋ช…'
	sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)


๋ฐ˜์‘ํ˜•
๋ฐ˜์‘ํ˜•

Error [ERR HTTP HEADERS_SENT]: Cannot set headers after they are sent to the client



response.send() ํ•œ๋ฒˆ๋งŒ!

๋ฐ˜์‘ํ˜•
๋ฐ˜์‘ํ˜•

์ฐธ๊ณ ํ•จ : https://stackoverflow.com/questions/19051041/cannot-overwrite-model-once-compiled-mongoose



์—๋Ÿฌ๊ฐ€๋‚˜์„œ ๋ณด๋‹ˆ

์Šคํ‚ค๋งˆ ์„ ์–ธ์„ ํ•œ๋ฒˆ๋งŒ ๋กœ๋“œํ•˜๋ผ๋Š” ๋œป์ธ๊ฑฐ๊ฐ™์•˜๋‹ค.


์ „์—ญ์—๋‹ค๊ฐ€ ์„ ์–ธ์„ ํ•ด๋†“๋“ ,

์ตœ์ดˆ ์‹คํ–‰ ํ•จ์ˆ˜(์ƒ์„ฑ์ž) ๊ฐ™์€๊ณณ์— 

์ตœ์ดˆ ํ•œ๋ฒˆ๋งŒ ๋ถ€๋ฅด๋‹ˆ ์—๋Ÿฌ๊ฐ€ ์•ˆ๋‚œ๋‹ค.



๋ฐ˜์‘ํ˜•
๋ฐ˜์‘ํ˜•

์ž˜๋˜๋˜ ํ”„๋กœ์ ํŠธ์˜€๋Š”๋ฐ,


์„œ๋ฒ„๋ฅผ ์‹คํ–‰ํ•˜๋‹ˆ, 500์—๋Ÿฌ๋ฅผ ๋ฑ‰์œผ๋ฉด์„œ

Servlet.init() for servlet appServlet threw exception


์ด๋Ÿฐ๋ฌธ๊ตฌ์™€ํ•จ๊ป˜,

Error creating bean with name 'org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean#0

์ด๋Ÿฌํ•œ ์—๋Ÿฌ๊ฐ€ ๋‚˜์™€์„œ ์ฐพ๋˜์ค‘

- ์ฐธ๊ณ  : https://stackoverflow.com/questions/35986200/error-creating-bean-with-name-org-springframework-validation-beanvalidation-opt


์œ„์˜ ์‚ฌ์ดํŠธ์˜ ๋‚ด์šฉ์œผ๋กœ ํ•ด๊ฒฐํ•จ!



๊ฐ€๋” *.jar ๋ฒ„์ „์ด ์•ˆ๋งž๊ฑฐ๋‚˜(๋ฒ„์ „์ด ์˜ฌ๋ผ๊ฐ€๊ฑฐ๋‚˜) ํ•˜๋ฉด ์ €๋Ÿฐ์‹์œผ๋กœ ์•ˆ๋งž๋Š”๋‹ค๊ณ  ์—๋Ÿฌ๋ฅผ ๋‚ด๋ฑ‰๋Š” ๋ชจ์–‘


pom.xml์„ 

<dependency> 

<groupId>org.hibernate</groupId> 

<artifactId>hibernate-validator</artifactId> 

<version>5.2.4.Final</version>

</dependency> 


์œผ๋กœ ๋งž์ถฐ์ฃผ๊ณ , 


dtoํŒจํ‚ค์ง€์˜ ๊ด€๋ จ ํด๋ž˜์Šค๋„ ๋งž์ถฐ์ฃผ๋‹ˆ ํ•ด๊ฒฐ!

๋ฐ˜์‘ํ˜•
๋ฐ˜์‘ํ˜•

๋ฉ”์ด๋ธ ํ”„๋กœ์ ํŠธ ๋นŒ๋“œ ์ค‘์—


Invalid LOC header


๋ผ๋Š” ์—๋Ÿฌ๊ฐ€ ๋‚˜์™€์„œ ๋ญ”๊ฐ€ํ•˜๊ณ  ์ฐพ์•„๋ณด์•˜๋Š”๋ฐ,


jar ํŒŒ์ผ์ด ๊นจ์ ธ์„œ ํ˜น์€ jar ํŒŒ์ผ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†์–ด์„œ ๋‚˜๋Š” ์—๋Ÿฌ๋ผ๊ณ  ํ•œ๋‹ค.


๋ฐฉ๋ฒ•์œผ๋กœ๋Š” ํ•ด๋‹น ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ํŒŒ์ผ(*.jar)์„ ์ฐพ์•„ ์ง€์šฐ๊ณ  ๋‹ค์‹œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ(*.jar)๋ฅผ ๋ถˆ๋Ÿฌ์™€๋ผ์˜€๋‹ค.

(๋‹ค์‹œ ๋ถˆ๋Ÿฌ์˜จ๋‹ค๋Š”๊ฑด pom.xml ์— ๋‹ค์‹œ ์„ค์ •์„ ํ•˜์—ฌ ๋ถˆ๋Ÿฌ์˜ค๋ผ๋Š” ์–˜๊ธฐ์ผ ๊ฒƒ์ด๊ฒ ์ง€)



์ง€์›Œ๋ณด๊ณ ๋„ ์•ˆ๋˜๋ฉด, ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๋ฒ„์ „ํ™•์ธ๋„ ํ•ด๋ณผํ•„์š”๊ฐ€ ์žˆ์„๊ฒƒ์ด๋‹ค.


๋‚˜์˜๊ฒฝ์šฐ๋Š”, aspectj ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ๋Œ€ํ•œ ์—๋Ÿฌ์˜€๋Š”๋ฐ,

์ž๋ฐ”๋ฒ„์ „์ด๋ž‘ aspectj๋ฒ„์ „์ด๋ž‘ ์•ˆ๋งž์•„์„œ ๊ทธ๋žฌ๋‹ค.


-- pom.xml

<properties>

<java-version>1.8</java-version>

<org.springframework-version>4.0.4.RELEASE</org.springframework-version>

<org.aspectj-version>1.8.1</org.aspectj-version> <!-- 1.6.0์—์„œ 1.8.1๋กœ ์˜ฌ๋ ค์คŒ-->

<org.slf4j-version>1.6.6</org.slf4j-version>

</properties>


๊ทธ๋žฌ๋”๋‹ˆ ์—๋Ÿฌ๊ฐ€ ์—†์–ด์กŒ๋‹ค.


์ฐธ๊ณ  : https://www.slipp.net/wiki/pages/viewpage.action?pageId=1343532

๋ฐ˜์‘ํ˜•
๋ฐ˜์‘ํ˜•

jdbc ์—ฐ๋™ํ•˜๋ ค๊ณ  ํ•˜๋Š”๋ฐ 


Cannot create PoolableConnectionFactory (Could not create connection to database server.)

์—๋Ÿฌ๊ฐ€๋‚˜์„œ ์ฐพ์•„๋ณด์•˜๋‹ค.



๋‚˜์˜๊ฒฝ์šฐ๋Š” ๋กœ์ปฌ์ด ์•„๋‹Œ ์™ธ๋ถ€์„œ๋ฒ„(aws ์‚ฌ์šฉ)์— ์žˆ๋Š” DB(mysql)์— ์ ‘๊ทผํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์‹œ๋„ํ•˜๋ ค๊ณ  ํ–ˆ๋Š”๋ฐ

์™ธ๋ถ€์—์„œ ๋””๋น„์ ‘๊ทผ์ด ์•ˆ๋˜์„œ ์ €๋Ÿฐ ์—๋Ÿฌ๊ฐ€ ๋‚ฌ๋˜ ๊ฒƒ์ด๋‹ค.



๋”ฐ๋ผ์„œ ๋””๋น„ ๋‚ด์— ์ ‘์† ๊ฐ€๋Šฅํ•œ IP๋ฅผ ์—ด์–ด์ค˜์•ผํ•จ. (ํŠน์ • ์•„์ดํ”ผ ํ˜น์€ ์ „์ฒด)

mysql.user ํ…Œ์ด๋ธ”์— host๋ช…์„ %๋กœ ๋“ฑ๋ก ํ•ด๋†“์œผ๋ฉด ๋ชจ๋“  IP ์ ‘์† ๊ฐ€๋Šฅ




1) ํ•ด๋‹น์„œ๋ฒ„ ๋””๋น„์ ‘์†

root@ip-@@@@:~# mysql -u root -p

Enter password: ๋น„๋ฐ€๋ฒˆํ˜ธ ์ž…๋ ฅ


2) ์ˆœ์„œ๋Œ€๋กœ ์‹คํ–‰

mysql> use mysql

mysql>INSERT INTO mysql.user (host,user,authentication_string, ssl_cipher, x509_issuer, x509_subject) VALUES ('%','root',password('๋น„๋ฐ€๋ฒˆํ˜ธ'), '', '', '');

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; -- ๋ชจ๋“  ํ˜ธ์ŠคํŠธ์— ์ ‘์† ํ—ˆ์šฉ...

mysql>FLUSH PRIVILEGES; -- ๊ถŒํ•œ๋ณ€๊ฒฝ ์ ์šฉํ•˜๊ณ , ์•Œ๋ฆฌ๋Š” ๋ช…๋ น์–ด



~ ๋ 



- ์ฐธ์กฐ : https://medium.com/mo-mu/%EA%B0%9C%EB%B0%9C%EC%9D%BC%EC%A7%80-%EC%9B%90%EA%B2%A9%EC%84%9C%EB%B2%84-mysql%EC%97%B0%EA%B2%B0-sql%ED%8C%8C%EC%9D%BC-import-9abfb0a711da


http://zetawiki.com/wiki/MySQL_%EC%9B%90%EA%B2%A9_%EC%A0%91%EC%86%8D_%ED%97%88%EC%9A%A9



๋ฐ˜์‘ํ˜•

+ Recent posts