월 17,600원
5개월 할부 시다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
@EnableFeignClients 어노테이션 인식 안됨
강사님 안녕하세요! 강사님 덕분에 매우 많이 배워나가고 있습니다. 아무리 구글링을 해도 해결책을 찾지 못해 질문드리게 되었습니다. 메이븐을 돌려도 에러는 안 나는데 @EnableFeignClients 를 호출할 수 없는 오류가 계속 발생하여 질문드립니다.<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.7.3</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.inflearn</groupId> <artifactId>user-service</artifactId> <version>0.0.1-SNAPSHOT</version> <name>user-service</name> <description>Demo project for Spring Boot</description> <properties> <java.version>11</java.version> <spring-cloud.version>2021.0.3</spring-cloud.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <!-- h2 --> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <version>2.1.214</version> <scope>runtime</scope> </dependency> <!-- Validation --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> <version>2.7.3</version> </dependency> <!-- JPA --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> <version>2.7.3</version> </dependency> <!-- ModelMapper --> <dependency> <groupId>org.modelmapper</groupId> <artifactId>modelmapper</artifactId> <version>3.1.0</version> </dependency> <!-- Spring Security --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> <version>2.7.3</version> </dependency> <!-- JWT --> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt</artifactId> <version>0.9.1</version> </dependency> <!-- Config Server와 연동하기 위함, config --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-config</artifactId> </dependency> <!-- Config Server와 연동하기 위함, bootstrap (서버 재기동) --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-bootstrap</artifactId> </dependency> <!-- Config Server와 연동하기 위함, Actuator (서버 재기동 x) --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <!-- AMQP --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-bus-amqp</artifactId> </dependency> <!-- openfeign --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-openfeign</artifactId> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>${parent.version}</version> <configuration> <excludes> <exclude> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </exclude> </excludes> </configuration> </plugin> </plugins> </build> </project>
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
카프카 topics 삭제 질문이요...
현재 기존에 있던 orders와 my_topic_users 토픽을 삭제하려고한다./c/Work/Kafka-practice/kafka 위치에서$ ./bin/windows/kafka-topics.bat --bootstrap-server localhost:9092 --list 명령어로 토픽이름 확인하니까 다음과 같이 나옵니다.__consumer_offsetsconnect-configsconnect-offsetsconnect-statusexample-catalog-topicmy_topic_usersorders/c/Work/Kafka-practice/kafka 위치에서$ ./bin/windows/kafka-topics.bat --delete --topic orders --bootstrap-server localhost:9092 이렇게 orders 토픽 삭제 명령어를 입력했습니다.(입력후 새로운 경로창 이 나오며 커맨드라인이 명령어 먹은것 처럼 일어남)그러고 나서 다시$ ./bin/windows/kafka-topics.bat --bootstrap-server localhost:9092 --list 명령어로 토픽 리스트를 보려고하는데..아래와 같은 에러가 나서 검색해보니까[2022-09-06 14:33:35,758] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)현재 zookeeper 실행시킨다음./bin/windows/kafka-server-start.bat ./config/server.properties 명령어로 kafka 실행시켜도 안켜집니다./c/Work/Kafka-practice/kafka 위치에서vim ./config/server.properties 으로 해당 파일 접속하면listeners=PLAINTEXT://:9092 부분 이 주석 되있는데이 부분을 주석 해제하고 저장했습니다.그래도 여전히 동일한 오류로 kafka는 안켜지며토픽리스트 또한 동일한 에러가 나면서 안보여집니다..그래서 일단 listeners=PLAINTEXT://:9092 부분 다시 주석으로 원복 시켰습니다.그리고나서 동일한 ./config/server.properties 파일에서#advertised.listeners=PLAINTEXT://your.host.name:9092이 부분을 주석 풀고 아래처럼 변경함advertised.listeners=PLAINTEXT://localhost:9092그래도 여전히 kafka는 안켜지며 토픽리스트도 안보여집니다...kafka 실행시키면 에러나면서 꺼지는데마지막에는 다음과 같은 에러가 발생합니다...[2022-09-06 15:08:10,341] INFO [ReplicaAlterLogDirsManager on broker 0] Removed fetcher for partitions Set(orders-0) (kafka.server.ReplicaAlterLogDirsManager)[2022-09-06 15:08:10,351] ERROR Shutdown broker because all log dirs in C:\tmp\kafka-logs have failed (kafka.log.LogManager)검색하고 해볼 수 있는건 다 해봐서그냥 windows로 올려주신 카프카 설정을 다시 다운받고 할까 생각중인데..그래도 왜 안되는지는 알아야할 것같습니다..어떻게하면 이 상황을 해결할 수 있을까요?
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
mariadb를 order-service의 application.yml에 등록하고 실행이 안됩니다.
안녕하세요 강사님 강의 잘 듣고있습니다. 현재저는 windows 운영체제 환경입니다.제가 orders Microservice수정 - mariadb 강의 부분을 듣다가mariadb를 order-serviced의 application.yml에 설정하고application.yml의 mariadb관련 설정은 다음과 같습니다. ( 참고로 저는 3307포트 사용합니다.)datasource: url: jdbc:mariadb://localhost:3307/mydb driver-class-name: org.mariadb.jdbc.Driver username: root password: 123456이상태에서 order-service를 실행시키니까 다음과 같은 에러가 발생했습니다.java.sql.SQLInvalidAuthorizationSpecException: Could not connect to address=(host=localhost)(port=3307)(type=master) : (conn=3) Access denied for user 'root'@'localhost' (using password: YES)Current charset is UTF-8. If password has been set using other charset, consider using option 'passwordCharacterEncoding' 에러를 검색해보니까계정에 대한 접근 권한이 제대로 설정되지 않은 경우로 보였습니다.그래서 접근 권한을 변경해주려고 했습니다.기존에> show grants for root@localhost; ( show grants; ) 명령어를 입력하면 다음과 같았고> show grants for root@'%'; 명령어를 입력하면 다음과 같았습니다.그래서grant all privileges on root.* to root@'localhost' identified by 'root'; 명령어와grant all privileges on root.* to root@'%' identified by 'root'; 명령어를 입력해 보았다.(사실 에러를 해결하려고 권한을 주려고한건데.. identified by '비밀번호' 로 설정되는걸 몰랐습니다..) > grant all privileges on root.* to root@'localhost' identified by 'root'; 명령어 입력후에> show grants; 확인하면 빨간줄이 추가 됐습니다. 그리고 password도 변경됐습니다.> grant all privileges on root.* to root@'%' identified by 'root'; 명령어 입력후> show grants for root@'%'; 빨간줄이 추가됐습니다. 그리고 password도 변경됐습니다.그리고 나서유레카 서버를 실행시키고주키퍼, 카프카 , 카프카커넥트 까지 실행시키고apigateway 실행, config-service 실행 user-service 실행한 후마지막으로 order-service를 실행시키니까 됩니다.그런데 문제는kafka 마지막 강의인 kafka를 활용한 데이터 동기화2 부분을 따라하는데즉, orderservice를 2개 실행시키고 db에 등록이 잘 되나 확인하는 과정에서주문 요청을 잘되는데db에 등록이 안됩니다... 심지어 order-service#1, order-service#2콘솔에 모두 번갈아가며 데이터가 들오는 것도 확인했습니다.하지만 mariadb 에는 데이터가 들어가지 않습니다.h2-console에서 확인한 mariadb와 명령프롬프트 창으로 킨 마리아db모두 데이터가 들어오지않습니다. 그러다가grant all privileges on root.* to root@'localhost' identified by '123456'; 명령어와grant all privileges on root.* to root@'%' identified by '123456';이렇게 한번 바꾸고 다시grant all privileges on root.* to root@'localhost' identified by 'root'; 명령어와grant all privileges on root.* to root@'%' identified by 'root';명령어를 치고 서버를 다시 실행시키니까 데이터가 아까 요청한게 전부 들어가 있습니다...(근데 사실 mariadb의 mydb에는 postman에서 요청한0eabbd2e-f8d3-448f-89c1-79642b7ea765 이런 형식의 userId가 없는데 어떻게 데이터가 들어갔는지 의문이네요) 걸리는게"my-source-connect", "my-sink-connect", "my-order-sink-connect"이 3가지를 post 요청으로 등록할 때"connection.password":root 가 아니라"connection.password":123456 이었습니다. (히스토리 확인해보니까 확실히 맞습니다.) 또한 my-order-sink-connect를 등록할 때는 mariadb는grant all privileges on root.* to root@'localhost' identified by '123456'; 명령어와grant all privileges on root.* to root@'%' identified by '123456';을 적용한 채로 커넥트를 등록한것 같았습니다.. (사실 계속 왔다갔다 해서 확실하지 않습니다.) 현재 기존에 order-service의 application.yml에 mariadb를 등록하기 전에users/{userId} 으로 get 요청하는 것도"orders": []현재 orders의 정보가 나오지 않는 상황입니다.. 결론은 현상황을 어떻게 해결해야할지 모르겠습니다..일단 처음에러를 잘 대처한거부터가 맞는건지 모르겠습니다..현상황을 해결할 수 있는 방법이 있는지아니면 처음 에러가 발생했을 때 어떻게 해결을 해야할지 알려주시면 감사하겠습니다..긴글 읽어주셔서 감사합니다.. 마지막으로 현재 order-service의 jpa, datasource 관련 application.yml 설정은 다음과 같습니다. jpa: hibernate: ddl-auto: update # 변경된 내용이 있을 경우에만 업데이트 show-sql: true generate-ddl: true datasource: url: jdbc:mariadb://localhost:3307/mydb driver-class-name: org.mariadb.jdbc.Driver username: root password: root
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
mariadb 가 h2-console에서 연결이 안됩니다..
현재 저는 Order Microservice에서 mariaDB 연동 강의를 듣고있습니다.제가 mysql이 3306 포트를 사용중이라mariadb port를 3307로 설정했으며 db이름은 mydb로 생성했습니다.그리고 비밀번호도 제대로 입력한거 맞습니다.그런데 order-service에서 h2-console에서 비밀번호까지 입력하고 Test Connection하면 연결이 안됩니다.저는 분명히 pom.xml에서 다음과같이 mariadb 디펜던시를 추가하고(혹시몰라서 mavenrepository 사이트에있는거 복사했습니다.) 메이븐 새로고침까지 누르고order-service를 실행했습니다.<dependency> <groupId>org.mariadb.jdbc</groupId> <artifactId>mariadb-java-client</artifactId> <version>2.7.2</version> </dependency>그리고 Maven 확인해도 mariadb 디펜던시는 추가돼있습니다...현재 order-service의 application.yml은 다음곽 같습니다.. 설정정보가 대체 뭐가 문제일까요??server: port: 0 # 0번 포트는 랜덤포트 spring: application: name: order-service h2: console: enabled: true settings: web-allow-others: true path: /h2-console jpa: hibernate: ddl-auto: update show-sql: true generate-ddl: true datasource: driver-class-name: org.h2.Driver url: jdbc:h2:mem:testMsaDb # jdbc url 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 #(127.0.0.1 = localhost) logging: level: com.example.orderservice: debug에러에는 계속Class "com.mariadb.jdbc.Driver" not found [90086-176] org.h2.message.DbException: Class "com.mariadb.jdbc.Driver" not found [90086-176] at org.h2.message.DbException.get(DbException.java:167) at org.h2.util.Utils.loadUserClass(Utils.java:672) at org.h2.util.JdbcUtils.getConnection(JdbcUtils.java:135) at org.h2.server.web.WebServer.getConnection(WebServer.java:693) at org.h2.server.web.WebApp.test(WebApp.java:896) at org.h2.server.web.WebApp.process(WebApp.java:222) at org.h2.server.web.WebApp.processRequest(WebApp.java:171) at org.h2.server.web.WebServlet.doGet(WebServlet.java:126) at org.h2.server.web.WebServlet.doPost(WebServlet.java:163) at javax.servlet.http.HttpServlet.service(HttpServlet.java:681) at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1789) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:750) Caused by: org.h2.jdbc.JdbcSQLException: Class "com.mariadb.jdbc.Driver" not found [90086-176] at org.h2.message.DbException.getJdbcSQLException(DbException.java:344) ... 44 more Caused by: java.lang.ClassNotFoundException: com.mariadb.jdbc.Driver at java.net.URLClassLoader.findClass(URLClassLoader.java:387) at java.lang.ClassLoader.loadClass(ClassLoader.java:419) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) at java.lang.ClassLoader.loadClass(ClassLoader.java:352) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at org.h2.util.Utils.loadUserClass(Utils.java:665) ... 42 more이라고 해서 검색해보면 해결책은 디펜던시 추가하는거 밖에 없습니다...뭐가 틀렸는지 잘 모르겠어서 질문남깁니다. 감사합니다..
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
갑자기 127.0.0.1:8000/user-service/** 가 작동하지 않습니다..
안녕하세요 현재 Microservice간 통신의RestTemplate 사용 강의를 듣던중에 포스트맨으로 테스트를 하는데POST 방식 요청인127.0.0.1:8000/user-service/users127.0.0.1:8000/user-service/login 은 잘됩니다.<br>하지만 GET 방식 요청인127.0.0.1:8000/user-service/users127.0.0.1:8000/user-service/users/welcome127.0.0.1:8000/user-service/users/health_check127.0.0.1:8000/user-service/users/{userId} 가 먹히지 않습니다.즉 디버깅 브레이크 포인트도 안걸리고 그냥 401 에러가 발생합니다...즉,127.0.0.1:8000/user-service/login 으로 얻은 response의 Header에 있는 token을가지고요청할 때 Bearer Token에 넣어도 401 에러가 발생합니다...난감합니다...갑자기 잘 되다가 왜이런지 모르겠네요..분명 apigateway-service의 application.yml에get방식은 AuthorizationHeaderFilter 를 걸어줬습니다..- id: user-service uri: lb://USER-SERVICE predicates: # 조건절이다. - Path=/user-service/** - Method=GET filters: - RemoveRequestHeader=Cookie - RewritePath=/user-service/(?<segment>.*), /$\{segment} - AuthorizationHeaderFilter<br>그런데 정말 이해가 안가는것이get 방식으로127.0.0.1:8000/user-service/** 요청을 하면 Bearer Token을 정상적으로 넣어도 401 에러가 발생하는데get 방식으로 user-service의 자체 포트번호를 넣고127.0.0.1:67026/** 이런식으로 요청하면 BearerToken을 잘못 넣어도 정상적으로 작동합니다...대체 왜이런거죠??<br>참고로 현재 저는 대칭키 방식을 이용한 암호화를 사용하고 있습니다.(비대칭키 암호화는 적용하지 않았습니다.)그런데 이것은 user-service에서 get방식으로 요청하는데 문제가 있어보이지는 않습니다..어떻게 하면 get방식에서 401 에러를 발생하지 않도록 할 수 있을까요?아니면 더 확인해야할 정보가 뭐가 있을까요?감사합니다.<br>현재 apigateway-service의 application.yml이 아래와 같이 되있고spring: cloud: config: uri: http://127.0.0.1:8888 name: ecommerce # ecommerce.yml 파일을 가져온다.native에 있는 ecommerce.yml 은 다음과 같습니다.token: expiration_time: 86400000 secret: user_token_native_ecommerce gateway: ip: 192.168.45.163참고로 token.secret이 user_token_native_ecommerce는 해당 ecommerce.yml 파일 밖에 없기 때문에 경로는 확실합니다. ( 확실히 config-service 의 application의 search-locations 경로 안에 ecommerce.yml 파일이 있습니다.)대체 뭐가 문제여서 get 방식으로127.0.0.1:8000/user-service/** 요청이 401 에러가 발생하는 것일까요?<br>혹시나해서 UserController도 같이 올려봅니다.@RestController @RequestMapping("/") public class UserController { private Environment env; private UserService userService; @Autowired private Greeting greeting; @Autowired public UserController(Environment env, UserService userService) { this.env = env; this.userService = userService; } @GetMapping("/health_check") public String status() { return String.format("It's Working in User Service" + ", port(local.server.port)="+ env.getProperty("local.server.port") + ", port(server.port)="+ env.getProperty("server.port") + ", token secret="+ env.getProperty("token.secret") + ", token expiration time="+ env.getProperty("token.expiration_time")); } @GetMapping("/welcome") public String welcome() { //return env.getProperty("greeting.message"); return greeting.getMessage(); } @PostMapping("/users") // 제네릭타입으로 반환할 형태도 명시할 수 있다. public ResponseEntity<ResponseUser> createUser(@RequestBody RequestUser user) { ModelMapper mapper = new ModelMapper(); mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); // RequestUser를 UserDto로 매핑한다. UserDto userDto = mapper.map(user, UserDto.class); userService.createUser(userDto); // userDto 를 ResponseUser 형으로 변경한다. ResponseUser responseUser = mapper.map(userDto, ResponseUser.class); // rest api 식으로 반환하자 return ResponseEntity.status(HttpStatus.CREATED).body(responseUser); // 201번 성공코드 반환 } @GetMapping("/users") public ResponseEntity<List<ResponseUser>> getUsers() { Iterable<UserEntity> userList = userService.getUserByAll(); List<ResponseUser> result = new ArrayList<>(); userList.forEach(v -> { result.add(new ModelMapper().map(v, ResponseUser.class)); }); // v를 ResponseUser 클래스로 변경 return ResponseEntity.status(HttpStatus.OK).body(result); } @GetMapping("/users/{userId}") public ResponseEntity<ResponseUser> getUser(@PathVariable("userId") String userId) { UserDto userDto = userService.getUserByUserId(userId); ResponseUser returnValue = new ModelMapper().map(userDto, ResponseUser.class); return ResponseEntity.status(HttpStatus.OK).body(returnValue); } }
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
질문 있습니다
order service1, order service 2 에 각각 db가 있는경우(MQ로 동기화)order service1, order service2 - MQ server - db 2번 방법은 db는 한개 1, 2의 경우를 설명해주셨는데 ,2번에 경우에도 특정 시점에서는 MQ server에서 db로 주문이 저장 안되서 총 5개 저장했을 때 DB에 3개 저장되고 MQ server에 아직 2개가 있을 때 사용자를 검색했을 때 해당 사용자의 order이 3개일 수도 있지 않나요 ?
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
porm.xml 관련 문제가 있는데 질문있습니다
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt</artifactId> <version>0.9.1</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <version>1.3.176</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-bus-amqp</artifactId> </dependency> <dependency> <groupId>org.modelmapper</groupId> <artifactId>modelmapper</artifactId> <version>2.3.8</version> </dependency> <dependency> <groupId>jakarta.validation</groupId> <artifactId>jakarta.validation-api</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-config</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-bootstrap</artifactId> </dependency> 위 패키지들을 추가하고 실행시키면 java: error reading /Users/user/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.65/tomcat-embed-core-9.0.65.jar; zip file is empty아래와 같은 에러가뜨는데 이유를 모르겠습니다 ...
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
Eureka 서비스 Nohup 다운 감지
안녕하세요? 교육잘받고있습니다. 감사합니다.springboot jar를 콘솔에서 포그라운드로 실행하여 Ctrl+C 하면 유레카가 자동으로 감지하는데. Nohup으로 백그라운드로 실행 후 kill 할경우 감지를 못해 Connection 오류가 발생을 합니다. 혹시 해결방법이 있다면 감사하겠습니다.
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
강의 자료는 어디서 받나요?
강의 자료는 어디서 받나요?소스를 받고싶습니다
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
IntelliJ 버전 관련
안녕하세요.IntelliJ IDEA 2022.2.1 다운로드 받은 툴에서는 스프링 부트 2.4 버전으로 프로젝트를 생성할 수 없습니다.( 2.6x 의 상위 버전만 존재.. )혹시 강사님께서 작업하신 소스를 Git 또는 알집파일, 그외 다른 유형 파일로 다운받아 IntelliJ툴에서 불러와서 작업할 수 있는 방법이 없을까요 ?
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
다수의 개발자가 같이 협업할 때에 궁금한 점이 있습니다.
안녕하세요!먼저 강의 너무너무 잘 보고 있습니다!공부를 하다가 갑자기 궁금한게 생겼는데,여러 개발자와 협업해야하는 환경이 될 때같은 서비스를 개발 할 시 개발 환경이 어찌 되는지 알고 싶습니다.Q1. 같은 서비스 개발 할 때에 디스커버리 서버와 APIGateway를 각자 개발자가 켜놓고 연관 된 서비스들도 다 실행 한 뒤에 개발을 하는지..Q2. 아니라면 APIGateway를 공용으로 사용시 따로 환경세팅이 있을까요?APIGateway를 공유하고 같은 서비스를 켜놓고 개발을 진행시 프론트에서 서비스 API등 호출 할 때에 제가 아닌 다른분의 서비스에 들어가면 어쩌지? 하는의문에서 시작되었습니다.너무너무 궁금합니다..강의는 너무 잘 보고 있고 다음강의도 기대하겠습니다!감사합니다.
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
feignclient와 kafka를 사용하는 방법의 이점
안녕하세요 강의 잘 보고 있고 질문있어 글 남깁니다. 현재 catalogservice에서 수량 update를 kafka를 하고 계신데, 수량 update는 feign client를 통해 서버간 api 호출을 통해서도 가능할 것 같습니다. 그런데 단순히 카프카의 여러가지 이점을 위해서 feign client를 사용한 서버 간 api 호출보다 해당 방식이 더 좋은건가요? feign client를 사용한 방식은 별로인 상황인가요? 그리고 혹시 만약 catalog 서비스 외의 다른 서비스에서도 catalog의 수량에 관심이 있어 order가 발행하는 수량 업데이트 메시지에 관심이 있다면 해당 서비스에서도 그대로 consumer 로직을 설정하면 데이터를 받을 수 있는 것인가요? 즉 데이터를 A가 가져간다하더라고 해당 데이터가 카프카 서버에 그대로 남아 다른 서비스(b)에서도 데이터를 받을 수 있는 것인지 궁금합니다.
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
Rabbit MQ 설치 해도 http://127.0.0.1:15672 동작 안함 문제 질문이요
안녕하세요 Rabbit MQ 설치 강의 듣고 있다가 명령프롬프트에 plugin 까지 설치하고 http://127.0.0.1:15672 을 실행시키니 전혀 되질 않습니다. 물론 래빗엠큐를 다운받고 서비스에서 Rabbit MQ 실행 상태를 확인해 본결과 실행중이 아니었습니다. 그래서 강제로 실행했는데 몇 초후 다시 새로고침하면 실행 중이 사라집니다... 당연히 환경변수로 추가했고요 어떻게 하면 래빗엠큐를 실행시킬수 있을까요..
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
actuator 방법이 안됩니다.
Configuration 서버의 정보가 변경이 됐을 때 정보를 다시 가지고 오는 방법들이 있는데 두번째 방법인 actuator를 이용하는데 refresh, health, beans 전부 안됩니다. health_check로 값을 확인하면 아래처럼 잘뜹니다. It's Working in User Service, port(local.server.port)=56550, port(server.port)=0, token secret=user_token, token expiration time=86400000 참고로 user-service에 bootstrap.yml 파일은 spring: cloud: config: uri: http://127.0.0.1:8888 name: ecommerce # ecommerce.yml 파일을 가져온다. git-local-repo에 있는 ecommerce.yml은 다음과 같습니다. token: expiration_time: 86400000 secret: user_tokengateway: ip: 192.168.45.163 그리고 config-service에 있는 application.yml 파일은 server: port: 8888spring: application: name: config-service cloud: config: server: git: uri: file://C:\Users\test\IdeaProjects\Inflearn\msa\git-local-repo 다음과 같습니다. 그런데 actuator 방법은 /health와 /beans 모두 Whitelabel Error Page가 뜨고 /refresh로 post 요청하면 { "timestamp": "2022-08-20T11:28:26.532+00:00", "status": 404, "error": "Not Found", "message": "No message available", "path": "/actuator/refresh" } 위와 같은 에러가 발생합니다.. 참고로 user-service의 application.yml에 management: endpoints: web: exposure: include: refresh, health, beans 을 추가했습니다. 그런데 강의처럼 자동완성은 전혀 뜨지 않았습니다. endpoints 부터 자동완성이 없었습니다. 대체 왜이런걸까요? 그리고 user-service에서 실행시키면 도대체 왜 config-service 프로젝트에 있는 application.yml 파일에 등록된 `uri: file://C:\Users\test\IdeaProjects\Inflearn\msa\git-local-repo` ( 제 ecommerce.yml 주소) 이 주소를 읽는건지 모르겠습니다. user-service의 bootstrap.yml에는 ecommerce(.yml) 밖에 없는데… 저 config-service에 있는 application.yml을 참조 하라는 표시를 대체 어디에 한건가요??
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
hasIpAddress("제 아이피") 허용안됩니다...
안녕하세요 user-service에서 WebSecurity를 작성하고 apigateway에 user-service 정보를 추가하고 - id: user-service uri: lb://USER-SERVICE predicates: - Path=/user-service/login - Method=POST filters: - RemoveRequestHeader=Cookie - RewritePath=/user-service/(?<segment>.*), /$\{segment}- id: user-service uri: lb://USER-SERVICE predicates: - Path=/user-service/users # 회원가입 - Method=POST filters: - RemoveRequestHeader=Cookie - RewritePath=/user-service/(?<segment>.*), /$\{segment}- id: user-service uri: lb://USER-SERVICE predicates: - Path=/user-service/** - Method=GET filters: - RemoveRequestHeader=Cookie - RewritePath=/user-service/(?<segment>.*), /$\{segment} 아래처럼 유레카 서버를 키고 user-service를 클릭했는데 forbbiden 403에러가 뜹니다.. 다음은 WebSecurity 코드입니다. @Configuration@EnableWebSecuritypublic class WebSecurity extends WebSecurityConfigurerAdapter { private UserService userService; private BCryptPasswordEncoder bCryptPasswordEncoder; private Environment env; public WebSecurity(Environment env, UserService userService, BCryptPasswordEncoder bCryptPasswordEncoder){ this.env = env; this.userService = userService; this.bCryptPasswordEncoder = bCryptPasswordEncoder; } @Override protected void configure(HttpSecurity http) throws Exception { // 권한 http.csrf().disable();// http.authorizeRequests().antMatchers("/users/**").permitAll(); // 모든걸 다 허용 http.authorizeRequests().antMatchers("/**") .hasIpAddress("192.168.45.163")// 해당 ip 허용 .and() .addFilter(getAuthenticationFilter()); // 이 필터를 통과하 데이터에 의해서만 허용한다. http.headers().frameOptions().disable(); // 프레임별로 데이터가 나눠져있는데 그걸 무시한다. } private AuthenticationFilter getAuthenticationFilter() throws Exception{ AuthenticationFilter authenticationFilter = new AuthenticationFilter(); authenticationFilter.setAuthenticationManager(authenticationManager()); return authenticationFilter; } @Override // 인증 (인증이 되야지만 권한 부여가 가능) protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userService).passwordEncoder(bCryptPasswordEncoder); }} 참고로 저는 스프링 부트 2.6.8 버전에 자바 1.8 버전을 사용합니다. 또한 참고로 UserController에 있는 리퀘스트 매핑은 @RequestMapping("/") 상태입니다. 그렇게 유레카 서버에서 user-service를 클릭하면 대략 다음과 같은 에러가 찍힙니다.. 검색해도 해결책은 안나오고... 뾰족한 수가 있을까요? 2022-08-19 16:58:55.562 ERROR 33392 --- [o-auto-1-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] threw exception java.lang.UnsupportedOperationException: public abstract java.lang.String javax.servlet.ServletRequest.getRemoteAddr() is not supported at org.springframework.security.web.FilterInvocation$UnsupportedOperationExceptionInvocationHandler.invoke(FilterInvocation.java:326) ~[spring-security-web-5.6.6.jar:5.6.6] at com.sun.proxy.$Proxy154.getRemoteAddr(Unknown Source) ~[na:na] at javax.servlet.ServletRequestWrapper.getRemoteAddr(ServletRequestWrapper.java:241) ~[tomcat-embed-core-9.0.65.jar:4.0.FR] at org.springframework.security.web.util.matcher.IpAddressMatcher.matches(IpAddressMatcher.java:65) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.access.expression.WebSecurityExpressionRoot.hasIpAddress(WebSecurityExpressionRoot.java:51) ~[spring-security-web-5.6.6.jar:5.6.6] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_322] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_322] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_322] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_322] at org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:139) ~[spring-expression-5.3.22.jar:5.3.22] at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:112) ~[spring-expression-5.3.22.jar:5.3.22] at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:95) ~[spring-expression-5.3.22.jar:5.3.22] at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:117) ~[spring-expression-5.3.22.jar:5.3.22] at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:309) ~[spring-expression-5.3.22.jar:5.3.22] at org.springframework.security.access.expression.ExpressionUtils.evaluateAsBoolean(ExpressionUtils.java:30) ~[spring-security-core-5.6.6.jar:5.6.6] at org.springframework.security.web.access.expression.WebExpressionVoter.vote(WebExpressionVoter.java:59) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.access.expression.WebExpressionVoter.vote(WebExpressionVoter.java:39) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:60) ~[spring-security-core-5.6.6.jar:5.6.6] at org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator.isAllowed(DefaultWebInvocationPrivilegeEvaluator.java:100) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator.isAllowed(DefaultWebInvocationPrivilegeEvaluator.java:67) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.access.RequestMatcherDelegatingWebInvocationPrivilegeEvaluator.isAllowed(RequestMatcherDelegatingWebInvocationPrivilegeEvaluator.java:76) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.boot.web.servlet.filter.ErrorPageSecurityFilter.isAllowed(ErrorPageSecurityFilter.java:88) ~[spring-boot-2.6.10.jar:2.6.10] at org.springframework.boot.web.servlet.filter.ErrorPageSecurityFilter.doFilter(ErrorPageSecurityFilter.java:76) ~[spring-boot-2.6.10.jar:2.6.10] at org.springframework.boot.web.servlet.filter.ErrorPageSecurityFilter.doFilter(ErrorPageSecurityFilter.java:70) ~[spring-boot-2.6.10.jar:2.6.10] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:106) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:87) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:219) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:213) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:102) ~[spring-web-5.3.22.jar:5.3.22] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:102) ~[spring-web-5.3.22.jar:5.3.22] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.6.jar:5.6.6] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354) ~[spring-web-5.3.22.jar:5.3.22] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267) ~[spring-web-5.3.22.jar:5.3.22] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.22.jar:5.3.22] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.22.jar:5.3.22] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:102) ~[spring-web-5.3.22.jar:5.3.22] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:102) ~[spring-web-5.3.22.jar:5.3.22] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:711) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:461) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:385) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:313) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:403) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:249) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1789) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) [tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.65.jar:9.0.65] at java.lang.Thread.run(Thread.java:750) [na:1.8.0_322] 음..
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
FeignClient 요청시 time out 오류
안녕하세요. FeignClient추가하고 postman으로 요청할때 userService에서 orderService호출 시 instance를 찾지 못해 timeout 오류가 나고 있는데 혹시 어떤 문제인지 알 수 있을까요? api-gateway통해서 127.0.0.1:8000/order-service로 요청할경우에는 받아와지는데; 앞에 ip 부분을 order-service 혹은 ORDER-SERVICE로 할경우 찾지 못하고 있습니다. 에러 로그 첨부 합니다. No instances found after removing previously used service instance from the search ([EurekaServiceInstance@72718591 instance = InstanceInfo [instanceId = order-service:ef68fdfd1a99f0253e22fe9eaf430e3c}, appName = ORDER-SERVICE, hostName = DESKTOP-8E7EO1V, status = UP, ipAddr = 192.168.0.* , port = 5201, securePort = 443, dataCenterInfo = com.netflix.appinfo.MyDataCenterInfo@dc0252a]). Returning all found instances.
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
actuator/busrefresh 가 동작하지 않습니다
안녕하세요 강의 잘 듣고 있습니다 GET HTTP method 방식의 acturator/beans, actuator/health API 호출은 잘 동작하지만 POST 방식의 acturator/refresh 또는 actuator/busrefresh API 호출은 에러가 발생하고 동작하지 않습니다 구글링을 해봐도 원인 파악이 어려워서 강의 진행이 어렵습니다.. 혹시 원인을 알고 계시면 안내해주시면 감사하겠습니다
- 해결됨Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
메이븐에 h2 1.3.176 버전이 의존성이 추가가 안됩니다..
1.3.176 버전을 등록하면 빨간줄 뜨고 계속 2.대 버전으로 업그레이드 하라고 뜹니다. 그렇게 1.4.200 이나 2.1.214 버전을 사용하고 Embeded 로 h2 db를 테스트 connection 하면 not found 라고 뜨면서 연결이 안됩니다.. 그리고 이미 test.mv.db 파일이 c/user/사용자이름 폴더에 존재합니다.. 이럴 땐 어떻게 해야할까요? 아래처럼 추가해주려고하는데 spring: datasource: url: jdbc:h2:tcp://localhost/~/testmsadb yml 파일에 추가가 안되네요 Cannot resolve configuration property 'spring.database.url' 라고 뜹니다. ( 아예 자동완성이 뜨질 않네요)... 이 상황을 어떻게 해결하면 좋을까요? 참고로 하나만 더 말씀드리면 web-admin-others : 는 빨간줄이 뜨고 h2: console: enabled: true settings: web-admin-others: true path: /h2-console Cannot resolve configuration property 'spring.h2.console.settings.web-admin-others' 라고 뜨네요 그리고 저는 spring boot 2.6.10 버전에 자바 1.8 스프링 클라우드 2021.0.3 버전을 사용하고 있습니다.
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
단일 DB 연결을 위한 Kafka 사용 이유 질문
안녕하세요 강사님, 너무 좋은 강의 잘 수강하고 있어 감사합니다. kafka 강의를 듣던 중 질문이 생겼는데요, 서로 다른 DB를 사용하는 각각의 마이크로서비스에서 데이터 동기화 문제를 해결하기 위해 Kafka를 사용한다는 것은 잘 알겠습니다. 그런데 동일한 DB를 사용하는 같은 마이크로서비스에서는 각각의 마이크로서비스에 서로다른 h2 DB가 연결되도록 하지 않고 동일한 mariadb로 설정해둔다면 데이터 동기화 문제는 없을 것 같은데 굳이 동일 마이크로서비스 내에서 서로 다른 인스턴스 사이의 데이터 동기화를 위해 kafka를 사용하는 이유가 무엇인지 잘 궁금해서 질문드립니다.
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
busrefresh 에러
안녕하세요. postman으로 busrefresh 전송할때 에러나서 어떻게 해결할 수 있을지 질문 드립니다. 127.0.0.1:8000/actuator/busrefresh 혹은 127.0.0.1:8000/user-service/actuator/busrefresh 로 전송하면 500 Internal Server Error 로 응답 받으면서 "org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.amqp.outbound.AmqpOutboundEndpoint@5c20f1e]; nested exception is org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect, failedMessage=GenericMessage [payload=byte[202], headers={id=673f43aa-6af0-73de-d386-1b08af6ed560, contentType=application/json, target-protocol=amqp, timestamp=1660318593074}]\r\n\tat org.springframework.integration.support.utils.IntegrationUtils.wrapInHandlingExceptionIfNecessary(IntegrationUtils.java:191)\r\n\tat org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:65)\r\n\tat org.springframework.cloud.stream.binder. 해당 에러메세지를 trace 값으로 내려받고 있습니다. user-service에서도 로그를 보면 Connection refused: connect 로그가 찍힙니다. application.yml에 management endpoint 부분에 busrefresh도 추가했습니다. 해당 설정에서 busrefresh를 제외한 다른 값들은 문제 없지 잘 작동하고 있습니다.