[Spring] Error : Application run failed

ggggraceful·2022년 10월 29일
0

Trouble Shooting

목록 보기
1/4
post-thumbnail

springsecurity와 jwt코드를 작성하고 실행을 돌렸는데
다음과 같은 에러가 발생하였다.

org.springframework.beans.factory.BeanCreationException
: Error creating bean with name 
  'org.springframework.cloud.aws.core.env.ResourceIdResolver.BEAN_NAME'
: Invocation of init method failed; 

<!--Try1에서 해결-->
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException
: Error creating bean with name 'stackResourceRegistryFactoryBean'
  defined in class path resource
 [org/springframework/cloud/aws/autoconfigure/context/ContextStackAutoConfiguration.class]
: Unsatisfied dependency 
   expressed through method 'stackResourceRegistryFactoryBean' parameter 0; 

<!--Try1에서 해결-->
nested exception is org.springframework.beans.factory.BeanCreationException
: Error creating bean with name 'amazonCloudFormation' 
  defined in class path resource 
  [org/springframework/cloud/aws/autoconfigure/context/ContextStackAutoConfiguration.class]
: Invocation of init method failed; 

nested exception is java.lang.IllegalStateException
: There is no EC2 meta data available, 
  because the application is not running in the EC2 environment. 
  Region detection is only possible if the application is running on a EC2 instance

< Try1 >

검색해보니
AWS S3를 연동한 스프링부트 프로젝트를 aws 서버에 배포할때 발생하는 에러라는 글을 보았다.
아직 s3를 사용하지 않는데 미리 빌드해 놓아 생긴 문제같았다.
(참고: https://private.tistory.com/76)
->> s3 빌드내용을 지워도 되겠지만, 나중에 또 추가할거니까
application.properties 파일에 cloud.aws.stack.auto=false 추가만 해보았다.

org.springframework.beans.factory.BeanCreationException
: Error creating bean with name 'amazonS3'
: Invocation of init method failed; 

nested exception is java.lang.IllegalStateException
: There is no EC2 meta data available, 
  because the application is not running in the EC2 environment. 
  Region detection is only possible if the application is running on a EC2 instance

< Try2 > : 해결

지우고 싶지 않았는데..
지워야 하나보다..
s3 빌드부분을 주석처리해보니 해결되었다!

profile
신입 백엔드개발자 (Java / Spring)

0개의 댓글