본문 바로가기

19년 WMS 회고록/Errors

프로젝트하는 과정에서 만난 여러 에러들..

**error 시 항상 생각해야 할 부분

에러는 여러 환경의 다름에서 생길 수 있다. 이러한 부분을 항상 염두에 두어야 한다.**

windows 환경과 macOS 환경도 다르다는 것을 인지하고 약간 다른 명령어 다른 행동 등을 해야만 한다.*

 

1. register key pair error

: 바탕화면에 있는 keypair는 Xshell에 등록이 안된다. 경로가 복잡해서 그런 거 같다.* USB 파일이나 아마도 C drive or D drive 같은 경로에 있어야 가능하다.**

 

2. 유의할 점

: ssh로 접속할 때,

ec2가 지정한 이름을 사용해야 접속할 수 있다.

그 지정한 이름은

root

ec2-user

 

3. Elastic beanstalk - create a environment.with springboot

: port를 지정해줘야만 정상적으로 만들어진다.*

: SERVER_PORT = 5000 below software

 

4. codeCommit

가능한 경우 Windows용 Git을 제거하고 다시 설치하십시오.

Windows용 Git을 설치할 때 Git Credential Manager 유틸리티 설치 옵션의 확인란 선택을 취소하십시오

 

5. 한글 꺠짐 문제 - spring data jpa

DataIntegrityViolationException to be thrown:

(conn=109) Incorrect string value: '\xEB\x8F\x99\xEC\x95\x84...' for column 'company_name' at row 1

SQL Error: 1366, SQLState: 22007

 

6. jpa 지연로딩 에러

: 준영속상태이므로, entityManager.merge() 사용.

: jpaRepository.save()를 다시 사용하면 merge가 된다.**

: 그리고 merge() 시에 즉, save()를 다시 한다면, 새로운 객체에 넣어서 사용할 것.

ex) SellingPartner persistSellingPartner = sellingPartnerRepository.save(sellingPartner);

그래서 이렇게 객체를 영속화시켜서 사용해야 한다.**

 

7. object references an unsaved transient instance -

save the transient instance before flushing

: 에러 원인은 save 후 지연 로딩이 되어서 flushing이 되기 전에 setter와 getter를 사용할 시 에러가 난다.

그러므로 save와 setter, getter를 한 트랜잭션 안에서 사용할 시, setter, getter를 먼저 사용하고 save를 할 것.

*이 에러에 대한 해결책

: 최초 save 전에 setter나 getter를 사용해야 한다.(한 트랜잭션 안에서)

: 한 트랜잭션 안에서 save와 동시에 setter와 getter를 사용하는 경우, setter와 getter를 먼저 사용하고 save를 나중에 해야한다.

ex) adjustStockInProduct(sales);

salesRepository.save(sales);

 

8. jpa - org.hibernate.TransientPropertyValueException:

object references an unsaved transient instance -

save the transient instance before flushing

: 이 에러시 save를 먼저 해주고 flushing이 된 상태의 값들을 사용해야 에러가 나지 않는다.

an unsaved transient instance를 사용해서 에러가 나는 것이다.

그러므로 save 후 autoflushing이 된 이후에 그 값들을 사용하면 에러가 발생하지 않는다.

 

9. com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

이유는 톰캣에 별도로 보안이 설정되어 있기 때문이다

그러므로, 3306 포트 즉, mysql에서 오는 접속을 허용해 줘야 할 필요가 있다

 

10. com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Springframework에서 MySQL을 사용할 때 특정 시점이 지나면 자동으로 커넥션을 잃어버리는 문제가 있다. 이 문제는 Springframework에서 아무런 오랜 시간 동안 데이터 요청이 없으면 커넥션과 풀링을 해지하는 기능을 가지고 있기 때문인데 이 문제를 해결하기 위한 방법을 소개한다.*

 

11. 다른 project를 다운로드하였을 때, 제대로 안 뜰 시.

- Maven 

click "Generates sources and Update Folders"

and then run.

or spring-boot:run

 

12. illegal character: '\ufeff'

: encoding에서 No BOM 선택, intellij 하단에 UTF-16 선택 후 convert 클릭

그 후 UTF-8 선택 후 convert 클릭해서 refresh 할 것.

 

13. parser error in thymeleaf

: view가 rendering 될 때, 그 view 안에 있는 entity가 있다면, 그 뷰를 rendering 하는 컨트롤러 메서드에서 그 entity를 model에 추가해주어야 한다.

'19년 WMS 회고록 > Errors' 카테고리의 다른 글

물류관리시스템 오류리스트  (0) 2021.11.04
Windows  (0) 2021.10.30
Linux  (0) 2021.10.30
docker  (0) 2021.10.30