[tomcat] Connector/J connection property ‘autoReconnect=true’ to avoid this problem

## tomcat Error 내용 / 실제 웹에서는 HTTP Status 500 – javax.servlet.ServletExeption 메세지 발생.

SEVERE: Servlet.service() for servlet [jsp] in context with path [] threw exception [javax.servlet.ServletException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 92226 seconds ago.The last packet sent successfully to the server was 94605 seconds ago, which is longer than the server configured value of ‘wait_timeout’. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property ‘autoReconnect=true’ to avoid this problem.] with root cause
java.net.SocketException: Broken pipe

# 사용환경
tomcat 7.x / java 1.7 / mysql 5.5

#원인
tomcat <> mysql간 연결 상태가 유휴 상태일 때 끊어지면서 발생하는 메시지.
DB 커넥션이 맺어진 후 사용이 없다보니 유휴상태로 변경 되면서 커넥션이 끊어짐

# 해결 방안 1.
특정 시간마다 커넥션 확인 하는 셋팅 추가
web-xml

# 해결 방안 2.
my.cnf 수정을 통해 mysql wait_timeout 값을 수정
wait_timeout = 3600

참고 URL : http://www.databaseskill.com/2971555/
참고 URL : http://stackoverflow.com/questions/15949/javatomcat-dying-database-connection
참고 URL : http://fbwotjq.tistory.com/entry/IBATIS-%EC%BB%A4%EB%84%A5%EC%85%98-%EC%97%90%EB%9F%AC
참고 URL : http://stackoverflow.com/questions/15949/javatomcat-dying-database-connection

Comments

comments

답글 남기기

이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다.