본문 바로가기
Java & Spring

NoClassDefFoundError: kotlin/reflect/full/KClasses 에러 발생 시

by 모닝위즈 2021. 12. 30.
반응형

자바 레거시 프레임워크에서 서비스단을 코틀린으로 사용할 때,



at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495) [tomcat-coyote.jar:8.0.47]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_144]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.47]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '서비스명' defined in file [파일경로]: Unexpected exception during bean creation; nested exception is java.lang.NoClassDefFoundError: kotlin/reflect/full/KClasses
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:518) ~[spring-beans-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312) ~[spring-beans-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205) ~[spring-beans-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:513) ~[spring-context-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:484) ~[spring-context-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:618) ~[spring-context-5.0.0.RELEASE.jar:5.0.0.RELEASE]

 

NoClassDefFoundError: kotlin/reflect/full/KClasses 와 같은 에러가 발생한다면, 

아래 dependency를 추가필요!

 


<dependency>
   <groupId>org.jetbrains.kotlin</groupId>
   <artifactId>kotlin-reflect</artifactId>
   <version>${kotlin.version}</version>
</dependency>
 

 

https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-reflect

위 URL에서 다운받아서 로컬 라이브러리로 등록해도 됩니다.

댓글