728x90
problem
No suitable driver found for 08001/0
java.sql.SQLException: No suitable driver found for
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:708)
H2 DB 연동 중 에러가 났다.
db를 못 찾는다는 에러다.
gradle 의존성을 확인 하거나,
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.username=sa
spring.datasource.password=
보통 이 설정 중 오타가 있으면, db 커넥션을 찾지 못해서 에러가 발생한다.

필자는 잘 넣었는데 h2 login 함수를 가보니 값들이 "" 공백으로 들어가서 커넥션을 찾지 못하는 것이었다.

근데 데이터는 분명 들어오고 있었다.
solution
필자는 로깅을 위해 서블릿 리퀘스트를 캐싱 하여, 사용하고 있었다.
캐싱 본문
class CachedHttpServletRequest(request: HttpServletRequest) : HttpServletRequestWrapper(request) {
private var cachedBody: ByteArray? = null
private var cachedMultipartFiles: Map<String, List<MultipartFile>> = emptyMap()
private var cachedParameterMap: Map<String, List<String>> = emptyMap()
private val cachedAttributes: ConcurrentHashMap<String, Any?> = ConcurrentHashMap()
companion object {
private val logger = LoggerFactory.getLogger(this::class.java)
}
init {
val attributeNames = request.attributeNames
while (attributeNames.hasMoreElements()) {
val name = attributeNames.nextElement() as String
cachedAttributes[name] = request.getAttribute(name)
}
try {
if (request is MultipartHttpServletRequest) {
this.cachedMultipartFiles = request.multiFileMap.mapValues { it.value.toList() }
this.cachedParameterMap = request.parameterMap.mapValues { it.value.toList() }
} else {
try {
request.inputStream.use { cachedBody = it.readBytes() }
} catch (e: IllegalStateException) {
logger.debug("요청에 입력 스트림이 없거나 이미 소비되었습니다: ${e.message}")
}
}
} catch (e: IOException) {
logger.warn("HttpServletRequest 캐싱 중 오류 발생: ${e.message}")
}
}
문제는
this.cachedParameterMap = request.parameterMap.mapValues { it.value.toList() }
파라메터를 캐싱 해주는 곳 이었는데,
래퍼 클래스로 쌓이면서 래퍼클래스의 getParameterNames 를 라이브러리에서 받아오지 못하는 것이었다.
위 캐싱을 test 에서 사용하지 않도록 했다.
위 에러가 뜨면, 서블릿 리퀘스트를 캐싱 하고 있지 않은지 확인 해보자.
728x90
'일-상 > 오류노트' 카테고리의 다른 글
| [오류노트] expo-iap 'AppTransaction' has no member 'appTransactionID' (0) | 2025.08.29 |
|---|---|
| [오류노트] android 실제 기기에서 이미지 안뜸 (feat.Naver Map) (4) | 2025.08.15 |
| [QueryDsl] transform 집계 함수 처리 (f.GROUP BY clause) (1) | 2025.06.09 |
| [오류노트] 개발자 도구 감지 기능 끄기 (0) | 2025.05.19 |
| [오류노트] 래핑된 ContentCachingRequestWrapper (0) | 2025.03.22 |