• Spring boot启动失败,提示找不到类:java.lang.NoClassDefFoundError: org/springframework/aop/framework/AopProxyUtils


      详细报错日志如下:

    D:DevJavajdk1.8.0_102injava.exe -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:D:DevIntelliJ IDEA 2018.3.5libidea_rt.jar=49426:D:DevIntelliJ IDEA 2018.3.5in" -Dfile.encoding=UTF-8 -classpath D:DevJavajdk1.8.0_102jrelibcharsets.jar;D:DevJavajdk1.8.0_102jrelibdeploy.jar;D:DevJavajdk1.8.0_102jrelibextaccess-bridge-64.jar;D:DevJavajdk1.8.0_102jrelibextcldrdata.jar;D:DevJavajdk1.8.0_102jrelibextdnsns.jar;D:DevJavajdk1.8.0_102jrelibextjaccess.jar;D:DevJavajdk1.8.0_102jrelibextjfxrt.jar;D:DevJavajdk1.8.0_102jrelibextlocaledata.jar;D:DevJavajdk1.8.0_102jrelibext
    ashorn.jar;D:DevJavajdk1.8.0_102jrelibextsunec.jar;D:DevJavajdk1.8.0_102jrelibextsunjce_provider.jar;D:DevJavajdk1.8.0_102jrelibextsunmscapi.jar;D:DevJavajdk1.8.0_102jrelibextsunpkcs11.jar;D:DevJavajdk1.8.0_102jrelibextzipfs.jar;D:DevJavajdk1.8.0_102jrelibjavaws.jar;D:DevJavajdk1.8.0_102jrelibjce.jar;D:DevJavajdk1.8.0_102jrelibjfr.jar;D:DevJavajdk1.8.0_102jrelibjfxswt.jar;D:DevJavajdk1.8.0_102jrelibjsse.jar;D:DevJavajdk1.8.0_102jrelibmanagement-agent.jar;D:DevJavajdk1.8.0_102jrelibplugin.jar;D:DevJavajdk1.8.0_102jrelib
    esources.jar;D:DevJavajdk1.8.0_102jrelib
    t.jar;E:workspacesubtitle-stub	argetclasses;E:Userswulf.m2
    epositorycomalibabafastjson1.2.21fastjson-1.2.21.jar;E:Userswulf.m2
    epositorycomsquareupokhttp3okhttp4.2.2okhttp-4.2.2.jar;E:Userswulf.m2
    epositorycomsquareupokiookio2.2.2okio-2.2.2.jar;E:Userswulf.m2
    epositoryorgjetbrainskotlinkotlin-stdlib1.3.71kotlin-stdlib-1.3.71.jar;E:Userswulf.m2
    epositoryorgjetbrainskotlinkotlin-stdlib-common1.3.71kotlin-stdlib-common-1.3.71.jar;E:Userswulf.m2
    epositoryorgjetbrainsannotations13.0annotations-13.0.jar;E:Userswulf.m2
    epositorychqoslogbacklogback-classic1.2.3logback-classic-1.2.3.jar;E:Userswulf.m2
    epositorychqoslogbacklogback-core1.2.3logback-core-1.2.3.jar;E:Userswulf.m2
    epositoryorgslf4jslf4j-api1.7.30slf4j-api-1.7.30.jar;E:Userswulf.m2
    epositoryorgprojectlomboklombok1.18.8lombok-1.18.8.jar;E:Userswulf.m2
    epositoryorgspringframeworkootspring-boot-starter-web2.2.6.RELEASEspring-boot-starter-web-2.2.6.RELEASE.jar;E:Userswulf.m2
    epositoryorgspringframeworkootspring-boot-starter2.2.6.RELEASEspring-boot-starter-2.2.6.RELEASE.jar;E:Userswulf.m2
    epositoryorgspringframeworkootspring-boot2.2.6.RELEASEspring-boot-2.2.6.RELEASE.jar;E:Userswulf.m2
    epositoryorgspringframeworkootspring-boot-autoconfigure2.2.6.RELEASEspring-boot-autoconfigure-2.2.6.RELEASE.jar;E:Userswulf.m2
    epositoryorgspringframeworkootspring-boot-starter-logging2.2.6.RELEASEspring-boot-starter-logging-2.2.6.RELEASE.jar;E:Userswulf.m2
    epositoryorgapachelogginglog4jlog4j-to-slf4j2.12.1log4j-to-slf4j-2.12.1.jar;E:Userswulf.m2
    epositoryorgapachelogginglog4jlog4j-api2.12.1log4j-api-2.12.1.jar;E:Userswulf.m2
    epositoryorgslf4jjul-to-slf4j1.7.30jul-to-slf4j-1.7.30.jar;E:Userswulf.m2
    epositoryjakartaannotationjakarta.annotation-api1.3.5jakarta.annotation-api-1.3.5.jar;E:Userswulf.m2
    epositoryorgspringframeworkspring-core5.2.5.RELEASEspring-core-5.2.5.RELEASE.jar;E:Userswulf.m2
    epositoryorgspringframeworkspring-jcl5.2.5.RELEASEspring-jcl-5.2.5.RELEASE.jar;E:Userswulf.m2
    epositoryorgyamlsnakeyaml1.25snakeyaml-1.25.jar;E:Userswulf.m2
    epositoryorgspringframeworkootspring-boot-starter-json2.2.6.RELEASEspring-boot-starter-json-2.2.6.RELEASE.jar;E:Userswulf.m2
    epositorycomfasterxmljacksoncorejackson-databind2.10.3jackson-databind-2.10.3.jar;E:Userswulf.m2
    epositorycomfasterxmljacksoncorejackson-annotations2.10.3jackson-annotations-2.10.3.jar;E:Userswulf.m2
    epositorycomfasterxmljacksoncorejackson-core2.10.3jackson-core-2.10.3.jar;E:Userswulf.m2
    epositorycomfasterxmljacksondatatypejackson-datatype-jdk82.10.3jackson-datatype-jdk8-2.10.3.jar;E:Userswulf.m2
    epositorycomfasterxmljacksondatatypejackson-datatype-jsr3102.10.3jackson-datatype-jsr310-2.10.3.jar;E:Userswulf.m2
    epositorycomfasterxmljacksonmodulejackson-module-parameter-names2.10.3jackson-module-parameter-names-2.10.3.jar;E:Userswulf.m2
    epositoryorgspringframeworkootspring-boot-starter-tomcat2.2.6.RELEASEspring-boot-starter-tomcat-2.2.6.RELEASE.jar;E:Userswulf.m2
    epositoryorgapache	omcatembed	omcat-embed-core9.0.33	omcat-embed-core-9.0.33.jar;E:Userswulf.m2
    epositoryorgapache	omcatembed	omcat-embed-el9.0.33	omcat-embed-el-9.0.33.jar;E:Userswulf.m2
    epositoryorgapache	omcatembed	omcat-embed-websocket9.0.33	omcat-embed-websocket-9.0.33.jar;E:Userswulf.m2
    epositoryorgspringframeworkootspring-boot-starter-validation2.2.6.RELEASEspring-boot-starter-validation-2.2.6.RELEASE.jar;E:Userswulf.m2
    epositoryjakartavalidationjakarta.validation-api2.0.2jakarta.validation-api-2.0.2.jar;E:Userswulf.m2
    epositoryorghibernatevalidatorhibernate-validator6.0.18.Finalhibernate-validator-6.0.18.Final.jar;E:Userswulf.m2
    epositoryorgjbossloggingjboss-logging3.4.1.Finaljboss-logging-3.4.1.Final.jar;E:Userswulf.m2
    epositorycomfasterxmlclassmate1.5.1classmate-1.5.1.jar;E:Userswulf.m2
    epositoryorgspringframeworkspring-web5.2.5.RELEASEspring-web-5.2.5.RELEASE.jar;E:Userswulf.m2
    epositoryorgspringframeworkspring-beans5.2.5.RELEASEspring-beans-5.2.5.RELEASE.jar;E:Userswulf.m2
    epositoryorgspringframeworkspring-webmvc5.2.5.RELEASEspring-webmvc-5.2.5.RELEASE.jar;E:Userswulf.m2
    epositoryorgspringframeworkspring-aop5.2.5.RELEASEspring-aop-5.2.5.RELEASE.jar;E:Userswulf.m2
    epositoryorgspringframeworkspring-context5.2.5.RELEASEspring-context-5.2.5.RELEASE.jar;E:Userswulf.m2
    epositoryorgspringframeworkspring-expression5.2.5.RELEASEspring-expression-5.2.5.RELEASE.jar;E:Userswulf.m2
    epositorycommons-codeccommons-codec1.13commons-codec-1.13.jar com.lxy.DemoApplication
    17:34:11.998 [main] INFO org.springframework.core.KotlinDetector - Kotlin reflection implementation not found at runtime, related features won't be available.
    Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.boot.SpringApplicationRunListener : org.springframework.boot.context.event.EventPublishingRunListener
        at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:445)
        at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:427)
        at org.springframework.boot.SpringApplication.getRunListeners(SpringApplication.java:416)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:304)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
        at com.lxy.DemoApplication.main(DemoApplication.java:9)
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.context.event.EventPublishingRunListener]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/framework/AopProxyUtils
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:217)
        at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:441)
        ... 6 more
    Caused by: java.lang.NoClassDefFoundError: org/springframework/aop/framework/AopProxyUtils
        at org.springframework.context.event.AbstractApplicationEventMulticaster.addApplicationListener(AbstractApplicationEventMulticaster.java:110)
        at org.springframework.boot.context.event.EventPublishingRunListener.<init>(EventPublishingRunListener.java:59)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:204)
        ... 7 more
    Caused by: java.lang.ClassNotFoundException: org.springframework.aop.framework.AopProxyUtils
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 14 more
    
    Process finished with exit code 1

      既然说类找不到,那么我们就去找一下吧,去哪找呢?在IDEA中看依赖的包,很明显,跟切面相关的就这个了:

      我们打开spring-aop-5.2.5.RELEASE.jar,确认AopProxyUtils.class存在:

       很明显,jar包里面没有东西,也可以去maven本地仓库看看:

       发现jar包大小不对。怎么办?把本地仓库的空jar包删掉,重新跑maven就可以再次下载

    D:DevJavajdk1.8.0_102injava.exe -Dmaven.multiModuleProjectDirectory=E:workspacesubtitle-stub -Dmaven.home=D:Devapache-maven-3.3.9 -Dclassworlds.conf=D:Devapache-maven-3.3.9inm2.conf "-javaagent:D:DevIntelliJ IDEA 2018.3.5libidea_rt.jar=50888:D:DevIntelliJ IDEA 2018.3.5in" -Dfile.encoding=UTF-8 -classpath D:Devapache-maven-3.3.9ootplexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2018.3.5 -s D:Devapache-maven-3.3.9confsettings.xml compile
    [INFO] Scanning for projects...
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building subtitle-stub 1.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/springframework/spring-aop/5.2.5.RELEASE/spring-aop-5.2.5.RELEASE.jar
    Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/springframework/spring-aop/5.2.5.RELEASE/spring-aop-5.2.5.RELEASE.jar (364 KB at 211.9 KB/sec)
    [INFO] 
    [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ subtitle-stub ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 1 resource
    [INFO] Copying 1 resource
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ subtitle-stub ---
    [INFO] Changes detected - recompiling the module!
    [INFO] Compiling 9 source files to E:workspacesubtitle-stub	argetclasses
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 7.713 s
    [INFO] Finished at: 2020-04-29T17:58:49+08:00
    [INFO] Final Memory: 31M/277M
    [INFO] ------------------------------------------------------------------------
    
    Process finished with exit code 0

      因为我们删掉了老jar包,这时如果打开IDEA的项目结构 -> 模块,会发现有红叉叉,重新指定一下新jar包即可:

       

      点击右边的笔进行编辑:

       

      选中Class后点击减号,删掉后点加号指定maven仓库的jar包:

       

      一路OK回去,再启动Spring Boot一切正常了。

  • 相关阅读:
    POJ1006(中国剩余定理)
    Ubuntu16.04安装jupiter
    OpenGL.tutorial06键盘和鼠标
    OpenGL.教程
    OpenGL.Qt532.cube
    Qt551.主窗体Margin
    Qt551.窗口滚动条
    Qt551.OpenGL.ZC简单例子
    Qt5OpenGL.顶点像素大小设置
    OpenGL.Tutorial03_Matrices_测试
  • 原文地址:https://www.cnblogs.com/wuxun1997/p/12803823.html
Copyright © 2020-2023  润新知