๐ฅ๏ธ ๋ญ๊ฐ๋ญ๊ฐํ๋ก์ ํธ/๐ ๏ธ ํธ๋ฌ๋ธ์ํ 5 [ํธ๋ฌ๋ธ์ํ ] ์์ธ ๋ฉ์์ง๊ฐ null๋ก ์ถ๋ ฅ๋ ๋ฌธ์ .. ๐ ๋ฌธ์ ํ์Kafka Consumer์์ ConflictException์ด ๋ฐ์ํ์ ๋, ๋ก๊ทธ ๋ฉ์์ง๊ฐ null๋ก ์ถ๋ ฅ๋๋ค.โ ๏ธ ์ฌ๊ณ ๋ถ์กฑ์ผ๋ก ๋ฉ์์ง ์ฒ๋ฆฌ ์คํจ: null→ getMessage()๋ก ์์ธ ๋ฉ์์ง๋ฅผ ์ถ๋ ฅํ์ง๋ง, null์ด ๋์๋ค. ๐ ์์ธ ๋ถ์โ ๊ธฐ์กด ์ฝ๋ ๊ตฌ์กฐpublic class ConflictException extends CustomRuntimeException { public ConflictException(ErrorCode errorCode) { super(errorCode); // message๋ ์ ๋ฌํ์ง ์์ }}@Getter@RequiredArgsConstructorpublic class CustomRuntimeException extends .. 2025. 5. 28. [ํธ๋ฌ๋ธ์ํ ] Kafka Consumer ์ฌ์๋ ์คํจ๋ก ์ธํ ๋ฉ์์ง ์ ์ค.. ๐ ๋ฌธ์ ํ์Kafka ๋ฉ์์ง๋ฅผ ์ ์์ ์ผ๋ก ์์ ํ ํ ์ฒ๋ฆฌ ๊ณผ์ ์์ ์์ธ๊ฐ ๋ฐ์ํ์ ๋, ๊ฐ์ ๋ก๊ทธ๊ฐ ๋ฐ๋ณต ์ถ๋ ฅ๋๋ฉด์ ๊ฒฐ๊ตญ ๋ฉ์์ง๊ฐ ํ๊ธฐ๋์๋ค..Backoff FixedBackOff{interval=0, currentAttempts=10, maxAttempts=9} exhausted for stock-management-topic-0@3 ๐ ์ฃผ์ ๋ก๊ทธListener method 'public void ... listen(...)' threw exception...Caused by: turtleMart.global.exception.ConflictException...DefaultErrorHandler : Backoff FixedBackOff{...} exhausted ๐ ์์ธ ๋ถ์Spring Ka.. 2025. 5. 28. [ํธ๋ฌ๋ธ์ํ ] key.serializer ๋๋ฝ๋์ ๋ Kafka ๋ฉ์์ง ์ ์ก ์คํจ ๐ ๋ฌธ์ ํ์Kafka ๋ฉ์์ง๋ฅผ ์ ์กํ๋ ค๊ณ ํ ๋ ์๋์ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ค.Invalid value null for configuration key.serializer: must be non-null ๐ ์์ธ ๋ถ์Kafka๋ ๋ฉ์์ง๋ฅผ ์ ์กํ๊ธฐ ์ํด key์ value๋ฅผ ์ง๋ ฌํํด์ผ ํ๋ฉฐ, ๋ฐ๋์ ๋ ๊ฐ์ง ์ค์ ์ด ํ์ํ๋ค.key.serializer → ๋ณดํต org.apache.kafka.common.serialization.StringSerializervalue.serializer → ๋ณดํต org.apache.kafka.support.serializer.JsonSerializerํ์ง๋ง ํ์ฌ KafkaTemplate์ ๊ตฌ์ฑํ ๋ ์ด ์ค์ ๋ค์ด ๋ช ์๋์ด ์์ง ์์์ ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ค. ๐ ํด๊ฒฐ ๋ฐฉ๋ฒKa.. 2025. 5. 27. [ํธ๋ฌ๋ธ์ํ ] QueryDSL .count().fetchOne()์์ ๋ฐ์ํ๋ NPE ๊ฒฝ๊ณ ํด๊ฒฐ ๋ฐฉ๋ฒ ๐ ๋ฌธ์ ์ํฉQueryDSL๋ก ์ํฐํฐ ๊ฐ์๋ฅผ ์กฐํํ ๋ ๋ค์๊ณผ ๊ฐ์ ์ฝ๋ ์ฌ์ฉํ๋ค.return queryFactory .select(sender.count()) .from(sender) .where(sender.courier.eq(courier), sender.isDeleted.isFalse()) .fetchOne(); // โ ๏ธ ๊ฒฝ๊ณ ๋ฐ์!์ด ์ฝ๋์์ IDE ๋๋ ์ปดํ์ผ๋ฌ๊ฐ ๋ค์๊ณผ ๊ฐ์ ๊ฒฝ๊ณ ๊ฐ ๋์์ก๋ค.โ Unboxing of 'fetchOne()' may produce 'NullPointerException' ๐ ์ ์ด๋ฐ ๊ฒฝ๊ณ ๊ฐ ๋ฐ์ํ ๊น?fetchOne()์ nullableํ Long ๊ฐ์ฒด๋ฅผ ๋ฐํํ๋ค.ํ์ง๋ง ๋ฐํ ํ์ ์ long(๊ธฐ๋ณธํ)์ผ๋ก ์ ์ธํด๋ฒ๋ฆฌ๋ฉด → ์ธ๋ฐ์ฑ ๊ณผ์ ์์ .. 2025. 5. 26. [ํธ๋ฌ๋ธ์ํ ] LazyInitializationException ๋ฐ์!! ๐ฃ ํธ๋ฌ๋ธ์ํ : LazyInitializationException ๋ฐ์ ๐ ๋ฌธ์ ์ํฉGET /api/senders ์์ฒญ ์ ๋ค์๊ณผ ๊ฐ์ ์๋ฌ๊ฐ ๋ฐ์ํ๋ค.org.hibernate.LazyInitializationException:Could not initialize proxy [turtleMart.delivery.entity.Courier#1] - no session๐ ์๋ฌ ์์ธSender ์ํฐํฐ๊ฐ Courier์ @ManyToOne(fetch = FetchType.LAZY) ๊ด๊ณ๋ก ์ค์ ๋์ด ์๋ค.senderRepository.findAll() ํธ์ถ๋ก Sender๋ฅผ ๊ฐ์ ธ์ค๊ณ ์ดํ DTO ๋ณํ ๊ณผ์ ์์ sender.getCourier().getName()์ ํธ์ถํ๋ค.ํ์ง๋ง ํธ๋์ญ์ ์ด ๋๋ ๋ค Lazy .. 2025. 5. 22. ์ด์ 1 ๋ค์