Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- Spring AOP
- ControllerAdvice
- 랜덤 테마
- exception
- ohmyposh
- checked exception
- 오마이포쉬
- Theme
- runtimeexception
- Custom Exception
- PowerShell
- undeclaredthrowableexception
Link
- Today
- Total
글
UndeclaredThrowableException?? (2) 본문
2024.06.02 - [Troubleshooting] - UndeclaredThrowableException ?? (1)
이전글
왜 UndeclaredThrowableException 이 발생했을까요?
프록시 인스턴스에서 호출된 메서드 (이 경우 컨트롤러의 메서드) 의 throw 절에 선언된 예외에 할당할 수 없는
'checked exception' 이 발생했을 때 던지는 예외였습니다.
package org.apache.tomcat.websocket;
public class AuthenticationException extends Exception
tomcat.websocket의 'AuthenticationException` 은 'Exception`을 상속하는 'checked exception` 이었기 때문에 `UndeclaredThrowableException` 이 발생한 것!
@Authenticate
@PostMapping
public IssueListResponse createIssue( ... ) throws AuthenticationException
위와 같이 컨트롤러 메서드 시그니쳐에 해당 예외를 추가해주면 그대로 Advice로 넘어가게 됩니다.
또는, RuntimeException (Unchecked Exception) 을 상속하는 custom exception으로 수정했을 때,
정상 작동했습니다.
'Troubleshooting' 카테고리의 다른 글
UndeclaredThrowableException?? (1) (0) | 2024.06.02 |
---|---|
[Java] Scanner nextInt() + nextLine() (0) | 2024.01.26 |