현상

런타임 오류: org.springframework.security.authentication.InternalAuthenticationServiceException: java.lang.NoClassDefFoundError: com/poc_lotte_chatbot/entity/QPartyRoleRelMstr

오류 원인 분석

NoClassDefFoundError

NoClassDefFoundError는 JVM이 클래스를 로드할 수 없을 때 발생합니다. 빌드 때는 있었지만 런타임 시 해당 클래스를 찾지 못할 때 발생

클래스 위치

문제의 클래스: com/poc_lotte_chatbot/entity/QPartyRoleRelMstr
보통 Q로 시작되는 클래스는 QueryDSL에서 자동 생성되는 entity 클래스

주요 원인

  1. QueryDSL 관련 클래스가 빠짐
  2. 의존성 누락
  • QueryDSL 관련 라이브러리 혹은 annotation processor build.gradle 또는 pom.xml에서 누락되었을 가능성
  1. 빌드 오류 혹은 클린 빌드 필요
  • 빌드 캐시 문제로 클래스가 생성되지 않은 채 빌드되었을 가능성

해결 방법

  1. QueryDSL Q-클래스 생성 확인
  • build/generated 폴더에서 QPartyRoleRelMstr 클래스 파일이 실제로 생성되었는지 확인
  1. 의존성 확인 및 Enable annotation processing

    dependencies {
     implementation 'com.querydsl:querydsl-jpa'
     annotationProcessor 'com.querydsl:querydsl-apt'
    }

settings > Build, Execution, Deployment > Compiler > Annotation Processors

```
3. 클린 빌드
Gradle: ./gradlew clean build
Maven: mvn clean install

'#개발 > spring' 카테고리의 다른 글

spring security 기본  (0) 2025.10.17
spring-boot-devtools  (0) 2025.10.08
H2 Database  (0) 2025.10.08
Thymeleaf  (0) 2025.10.08
프랙티스 가이드  (0) 2025.10.08

+ Recent posts