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

작성자 없음

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

스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술

HTTP 요청 데이터 - API 메시지 바디 - JSON

localhost8080 에서 json 경로만 500 서버 오류가 납니다

작성

·

321

0


[질문 템플릿]
1. 강의 내용과 관련된 질문인가요? (/아니오)
2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (/아니오)
3. 질문 잘하기 메뉴얼을 읽어보셨나요? (/아니오)

[질문 내용]
영한님 수업 잘 따라오면서 나머지 강의들은 잘 프로그램이 작동했는데 HTTP요청 데이터 -API 메시지 바디 -JSON강의 실습이후 json요청 페이지에서만 오류가 뜨고 localhost8080에서는 백지 화면이 뜹니다 제가 무지해 혹시 오류가 따로 있을거같아 컴파일보드 메모장으로 첨부해봅니다..

 

오후 11:15:43: Executing ':ServletApplication.main()'...

> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE

> Task :ServletApplication.main()

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.2.2)

2024-01-22T23:15:44.017+09:00  INFO 4424 --- [           main] hello.servlet.ServletApplication         : Starting ServletApplication using Java 21.0.1 with PID 4424 (C:\Users\�赿��\Desktop\Spring-mvc\servlet\build\classes\java\main started by �赿�� in C:\Users\�赿��\Desktop\Spring-mvc\servlet)
2024-01-22T23:15:44.018+09:00  INFO 4424 --- [           main] hello.servlet.ServletApplication         : No active profile set, falling back to 1 default profile: "default"
2024-01-22T23:15:44.667+09:00  INFO 4424 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port 8080 (http)
2024-01-22T23:15:44.676+09:00  INFO 4424 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2024-01-22T23:15:44.677+09:00  INFO 4424 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.18]
2024-01-22T23:15:44.711+09:00  INFO 4424 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2024-01-22T23:15:44.712+09:00  INFO 4424 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 652 ms
2024-01-22T23:15:44.787+09:00  INFO 4424 --- [           main] o.s.b.a.w.s.WelcomePageHandlerMapping    : Adding welcome page: ServletContext resource [/index.html]
2024-01-22T23:15:44.968+09:00  INFO 4424 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port 8080 (http) with context path ''
2024-01-22T23:15:44.973+09:00  INFO 4424 --- [           main] hello.servlet.ServletApplication         : Started ServletApplication in 1.2 seconds (process running for 1.426)
2024-01-22T23:15:49.563+09:00 DEBUG 4424 --- [nio-8080-exec-1] o.a.coyote.http11.Http11InputBuffer      : Before fill(): parsingHeader: [true], parsingRequestLine: [true], parsingRequestLinePhase: [0], parsingRequestLineStart: [0], byteBuffer.position(): [0], byteBuffer.limit(): [0], end: [0]
2024-01-22T23:15:49.564+09:00 DEBUG 4424 --- [nio-8080-exec-1] o.a.coyote.http11.Http11InputBuffer      : Received [GET / HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Cache-Control: max-age=0
sec-ch-ua: "Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Sec-Fetch-Site: none
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Accept-Encoding: gzip, deflate, br
Accept-Language: ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7

]
[��ü �Ķ���� ��ȸ] - start
[��ü �Ķ���� ��ȸ] - end
2024-01-22T23:15:49.582+09:00 DEBUG 4424 --- [nio-8080-exec-1] o.a.coyote.http11.Http11InputBuffer      : Before fill(): parsingHeader: [true], parsingRequestLine: [true], parsingRequestLinePhase: [0], parsingRequestLineStart: [0], byteBuffer.position(): [0], byteBuffer.limit(): [0], end: [704]
2024-01-22T23:15:49.582+09:00 DEBUG 4424 --- [nio-8080-exec-1] o.a.coyote.http11.Http11InputBuffer      : Received []
2024-01-22T23:15:49.583+09:00 DEBUG 4424 --- [nio-8080-exec-1] o.apache.coyote.http11.Http11Processor   : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@41b5971e:org.apache.tomcat.util.net.NioChannel@8c53d83:java.nio.channels.SocketChannel[connected local=/[0:0:0:0:0:0:0:1]:8080 remote=/[0:0:0:0:0:0:0:1]:51861]], Status in: [OPEN_READ], State out: [OPEN]
2024-01-22T23:15:49.598+09:00 DEBUG 4424 --- [nio-8080-exec-3] o.a.coyote.http11.Http11InputBuffer      : Before fill(): parsingHeader: [true], parsingRequestLine: [true], parsingRequestLinePhase: [0], parsingRequestLineStart: [0], byteBuffer.position(): [0], byteBuffer.limit(): [0], end: [704]
2024-01-22T23:15:49.599+09:00 DEBUG 4424 --- [nio-8080-exec-3] o.a.coyote.http11.Http11InputBuffer      : Received [GET /favicon.ico HTTP/1.1
Host: localhost:8080
Connection: keep-alive
sec-ch-ua: "Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
sec-ch-ua-platform: "Windows"
Accept: image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: no-cors
Sec-Fetch-Dest: image
Referer: http://localhost:8080/
Accept-Encoding: gzip, deflate, br
Accept-Language: ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7

]
[��ü �Ķ���� ��ȸ] - start
[��ü �Ķ���� ��ȸ] - end
2024-01-22T23:15:49.601+09:00 DEBUG 4424 --- [nio-8080-exec-3] o.a.coyote.http11.Http11InputBuffer      : Before fill(): parsingHeader: [true], parsingRequestLine: [true], parsingRequestLinePhase: [0], parsingRequestLineStart: [0], byteBuffer.position(): [0], byteBuffer.limit(): [0], end: [604]
2024-01-22T23:15:49.601+09:00 DEBUG 4424 --- [nio-8080-exec-3] o.a.coyote.http11.Http11InputBuffer      : Received []
2024-01-22T23:15:49.601+09:00 DEBUG 4424 --- [nio-8080-exec-3] o.apache.coyote.http11.Http11Processor   : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@41b5971e:org.apache.tomcat.util.net.NioChannel@8c53d83:java.nio.channels.SocketChannel[connected local=/[0:0:0:0:0:0:0:1]:8080 remote=/[0:0:0:0:0:0:0:1]:51861]], Status in: [OPEN_READ], State out: [OPEN]

답변 1

0

안녕하세요. 김동찬님, 공식 서포터즈 David입니다.

json 요청시 500 에러가 발생한 것으로 보입니다

500 에러의 경우 인텔리제이 콘솔 창에서 오류와 관련된 메시지를 출력하게 됩니다.

이 오류 메시지를 함께 올려주셔야 답변 드릴 수 있습니다.

오류 메시지를 질문과 함께 첨부해 주시길 요청드립니다:)

감사합니다.

따로 콘솔창에 오류관련 메시지는 없고 위에 올린 콘솔창이 전부입니다..처음부터 다시 설정이 필요할까요?

run을 stop하면 다음과 같이 콘솔창에 메시지가 뜨긴합니다

Unsupported Java. 
Your build is currently configured to use Java 21.0.1 and Gradle 8.5.

Possible solution:
 - Use Java 20 as Gradle JVM: Open Gradle settings 
 - Open Gradle wrapper settings, change `distributionUrl` property to use compatible Gradle version and reload the project

작성자 없음

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

질문하기