ERROR RESOLVING

오류 AWS EC2 404 찾을 수 없음, IllegalStateException

Adev 2023. 3. 7. 03:01

상황

AWS에 스프링 레거시 war 파일을 배포한 후, 주소창에 "퍼블릭ip:8080" 입력 시 톰캣 기본페이지는 잘 뜨는데 내 프로젝트명를 추가하면 404에러가 발생했다.

 

HTTP 상태 404 – 찾을 수 없음
타입 상태 보고
메시지 The requested resource [...] is not available
설명 Origin 서버가 대상 리소스를 위한 현재의 representation을 찾지 못했거나, 그것이 존재하는지를 밝히려 하지 않습니다.

 

톰캣 로그를 확인해 보니 프로젝트 실행 시 exception이 발생했다.

 

java.base@11.0.18/java.lang.Thread.run(Thread.java:829)
06-Mar-2023 12:18:57.099 INFO [mysql-cj-abandoned-connection-cleanup] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
        java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
                at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1432)
                at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1057)
                at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.checkThreadContextClassLoader(AbandonedConnectionCleanupThread.java:123)
                at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:90)
                at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
                at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
                at java.base/java.lang.Thread.run(Thread.java:829)

 

 

시도 

방법1 - server.xml 수정하기
<Host name="localhost" ~> 밑에 아래 코드를 추가한다.

 <Context docBase = "WAR파일명" path="/" reloadable="false"/>


결과 : 이번에는 "퍼블릭ip:8080"도 404에러가 떴다.

방법2 - server.xml 수정하기

포트 8005을 8004로 변경한다.

<!-- <Server port="8005" shutdown="SHUTDOWN"> -->

<Server port="8004" shutdown="SHUTDOWN">


방법3 - 톰캣 삭제후 재설치
sudo apt-get purge --auto-remove tomcat9

방법4 - ROOT.war로 이름 변경 후 배포하기

방법5 - 윈도우 방화벽 비활성화

방법6 - AWS EC2 root 계정 활성화시키기

방법7 - 톰캣 사용자, 그룹 생성 및 권한 주기
https://btcd.tistory.com/120 참고

방법8 - filezilla 대신 tomcat manager로 배포
https://yoonfeel-web.tistory.com/5 참고

 

 

해결 

EC2 인스턴스 삭제 후 새로 만드니 정상 작동했다,,ㅎ