인프런 커뮤니티 질문&답변

작성자 없음

작성자 정보가 삭제된 글입니다.

Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)

Orders Microservice - 기능 구현 ②

127.0.0.1:8000/order-service/fcec75e5-6858-4112-8659-34000efd1988/orders

23.01.30 21:51 작성

·

409

0

본 챕터 강의에 있는 모든 코드를 정상적으로 입력하였는데, 포스트맨으로 테스트시 에러가 발생합니다.

 

--- 포스트맨 입력 값 ---

POST 127.0.0.1:8000/order-service/fcec75e5-6858-4112-8659-34000efd1988/orders

{ "productId": "CATALOG-001", "qty": 10, "unitPrice": 1500 }

--- 포스트맨 반환 값 ---

{
    "timestamp": "2023-01-30T12:44:33.233+00:00",
    "status": 404,
    "error": "Not Found",
    "message": "No message available",
    "path": "/order-service/fcec75e5-6858-4112-8659-34000efd1988/orders"
}

 

 

답변 1

1

Dowon Lee님의 프로필 이미지
Dowon Lee
지식공유자

2023. 01. 31. 08:36

안녕하세요, 이도원입니다.

먼저, 해당 POST에 대한 요청을 order-service를 apigateway-service를 거치지 않고, 직접 요청했을 때에 대한 결과를 확인해 보시기 바랍니다. order-service에 대한 문제인지, apigateway-service에 order-service에 대한 router 설정이 잘못 된 것이진 문제를 확인해 봐야 할 것 같습니다. 오류 메시지에서 404 오류라는 코드를 봤을 때는 apigateway-service의 설정을 확인해 보시면 좋을 것 같습니다. 등록하신 application.yml 파일을 공유해 주시면, 원인을 같이 찾아보도록 하겠습니다.

감사합니다.

쾌활한 참새님의 프로필 이미지

2023. 02. 13. 17:48

확인 감사합니다 ㅠㅠ

apigateway-service를 거치지 않고, 직접 요청해도 동일한 에러가 발생합니다...

아래 코드는 order-service 의 application.yml 파일의 코드입니다.

server:
  port: 0

spring:
  application:
    name: order-service
  h2:
    console:
      enabled: true
      settings:
        web-allow-others: true
      path: /h2-console
  jpa:
    hibernate:
      ddl-auto: update

  datasource:
    driver-class-name: org.h2.Driver
    url: jdbc:h2:mem:testdb

eureka:
  instance:
    instance-id: ${spring.application.name}:${spring.application.instance_id:${random.value}}
  client:
    register-with-eureka: true
    fetch-registry: true
    service-url:
      defaultZone: http://127.0.0.1:8761/eureka

logging:
  level:
    com.example.orderservice: DEBUG

 

작성자 없음

작성자 정보가 삭제된 글입니다.

질문하기