Springboot startup error – classnotfound Exception:EnhancerBySpringCGLIB

Error classnotfound in springboot startup Exception:EnhancerBySpringCGLIB

Error information solution

Error information

Spring boot 2.4.1 project, start to report the following error, but start will be normal, although it does not affect the use, but look very boring.

java.lang.ClassNotFoundException: cn.demo.Application$$EnhancerBySpringCGLIB$$310af73e
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at cn.demo.ocean.common.prop.core.spring.SpringConfigPropertiesHandle.handleSpringConfig(SpringConfigPropertiesHandle.java:47)
	at cn.demo.ocean.common.prop.core.spring.ConfigServerPostProcessor.doProcessProperties(ConfigServerPostProcessor.java:305)
	at cn.demo.ocean.common.prop.core.spring.ConfigServerPostProcessor.processProperties(ConfigServerPostProcessor.java:122)
	at cn.demo.ocean.common.prop.core.spring.ConfigServerPostProcessor.postProcessBeanFactory(ConfigServerPostProcessor.java:102)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:299)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:170)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:751)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:569)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:326)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298)
	at cn.demo.Application.main(Application.java:19)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
java.lang.ClassNotFoundException: cn.demo.config.Swagger2Config$$EnhancerBySpringCGLIB$$589bf224
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at cn.demo.ocean.common.prop.core.spring.SpringConfigPropertiesHandle.handleSpringConfig(SpringConfigPropertiesHandle.java:47)
	at cn.demo.ocean.common.prop.core.spring.ConfigServerPostProcessor.doProcessProperties(ConfigServerPostProcessor.java:305)
	at cn.demo.ocean.common.prop.core.spring.ConfigServerPostProcessor.processProperties(ConfigServerPostProcessor.java:122)
	at cn.demo.ocean.common.prop.core.spring.ConfigServerPostProcessor.postProcessBeanFactory(ConfigServerPostProcessor.java:102)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:299)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:170)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:751)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:569)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:326)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298)
	at cn.demo.Application.main(Application.java:19)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)

solve

Baidu has failed for many times, so we can only read the error report carefully. Last line found:

at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)

Doubt is the problem of devtools, and then pom.xml Devtools dependency removal in

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <scope>runtime</scope>
    <optional>true</optional>
</dependency>

It’s solved (⊙ o ⊙)

Read More: