본문 바로가기

Linux(리눅스)

Failed to parse PID from file /app/tomcat/tomcat/temp/tomcat.pid: Invalid argument (tomcat 실행 문제) 에러

 

 

░░ The job identifier is 297835.
12월 23 17:08:31 im.lemonit.co.kr startup.sh[503889]: Tomcat started.
12월 23 17:08:31 im.lemonit.co.kr systemd[1]: CItomcat.service: Failed to parse PID from file /app/tomcat/tomcat/temp/tomcat.pid: Invalid argument
12월 23 17:10:01 im.lemonit.co.kr systemd[1]: CItomcat.service: start-post operation timed out. Terminating.
12월 23 17:10:01 im.lemonit.co.kr systemd[1]: CItomcat.service: Failed with result 'timeout'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://wiki.rockylinux.org/rocky/support
░░
░░ The unit CItomcat.service has entered the 'failed' state with result 'timeout'.
12월 23 17:10:01 im.lemonit.co.kr systemd[1]: Failed to start Apache Tomcat Web Application Container.
  • tomcat.pid 파일 생성 못하는 문제 때문에 톰캣 실행 중지되는 에러
[Service]
Type=forking
PIDFile=/app/tomcat/tomcat/temp/tomcat.pid
ExecStart=/app/tomcat/tomcat/bin/startup.sh

수정 ->

[Service]
Type=exec
ExecStart=/app/tomcat/tomcat/bin/catalina.sh run
ExecStop=/app/tomcat/tomcat/bin/shutdown.sh
  • catalina.sh 출력 리디렉션 추가 (1번 2번 둘중 하나 방법 선택)

1.

ExecStart=/app/tomcat/tomcat/bin/catalina.sh run

수정 ->

ExecStart=/app/tomcat/tomcat/bin/catalina.sh run > /app/tomcat/tomcat/logs/catalina.out 2>&1

2.

[Service]
Type=exec
ExecStart=/app/tomcat/tomcat/bin/catalina.sh run

수정 ->

[Service]
Type=exec
ExecStart=/app/tomcat/tomcat/bin/catalina.sh run
StandardOutput=append:/app/tomcat/tomcat/logs/catalina.out
StandardError=append:/app/tomcat/tomcat/logs/catalina.out
  • 설정을 변경한 후, systemd를 다시 로드하고 서비스를 재시작
sudo systemctl daemon-reload
sudo systemctl start CItomcat.service
sudo systemctl status CItomcat.service