"C:\Program Files\Java\jdk1.8.0_221\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2020.2\lib\idea_rt.jar=34672:C:\Program Files\JetBrains\IntelliJ IDEA 2020.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_221\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\rt.jar;C:\Users\Administrator\Documents\workspace\shop_platform\swagger\target\classes;D:\fshare\re\com\spring4all\swagger-spring-boot-starter\1.9.0.RELEASE\swagger-spring-boot-starter-1.9.0.RELEASE.jar;D:\fshare\re\io\springfox\springfox-swagger-ui\2.9.2\springfox-swagger-ui-2.9.2.jar;D:\fshare\re\io\springfox\springfox-bean-validators\2.9.2\springfox-bean-validators-2.9.2.jar;D:\fshare\re\io\springfox\springfox-swagger2\2.9.2\springfox-swagger2-2.9.2.jar;D:\fshare\re\io\swagger\swagger-annotations\1.5.20\swagger-annotations-1.5.20.jar;D:\fshare\re\io\swagger\swagger-models\1.5.20\swagger-models-1.5.20.jar;D:\fshare\re\com\fasterxml\jackson\core\jackson-annotations\2.9.5\jackson-annotations-2.9.5.jar;D:\fshare\re\io\springfox\springfox-spi\2.9.2\springfox-spi-2.9.2.jar;D:\fshare\re\io\springfox\springfox-core\2.9.2\springfox-core-2.9.2.jar;D:\fshare\re\net\bytebuddy\byte-buddy\1.8.12\byte-buddy-1.8.12.jar;D:\fshare\re\io\springfox\springfox-schema\2.9.2\springfox-schema-2.9.2.jar;D:\fshare\re\io\springfox\springfox-swagger-common\2.9.2\springfox-swagger-common-2.9.2.jar;D:\fshare\re\io\springfox\springfox-spring-web\2.9.2\springfox-spring-web-2.9.2.jar;D:\fshare\re\com\google\guava\guava\20.0\guava-20.0.jar;D:\fshare\re\com\fasterxml\classmate\1.4.0\classmate-1.4.0.jar;D:\fshare\re\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\fshare\re\org\springframework\plugin\spring-plugin-core\1.2.0.RELEASE\spring-plugin-core-1.2.0.RELEASE.jar;D:\fshare\re\org\springframework\spring-beans\4.0.9.RELEASE\spring-beans-4.0.9.RELEASE.jar;D:\fshare\re\org\springframework\spring-context\4.0.9.RELEASE\spring-context-4.0.9.RELEASE.jar;D:\fshare\re\org\springframework\spring-expression\4.0.9.RELEASE\spring-expression-4.0.9.RELEASE.jar;D:\fshare\re\org\springframework\spring-aop\4.0.9.RELEASE\spring-aop-4.0.9.RELEASE.jar;D:\fshare\re\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;D:\fshare\re\org\springframework\plugin\spring-plugin-metadata\1.2.0.RELEASE\spring-plugin-metadata-1.2.0.RELEASE.jar;D:\fshare\re\org\mapstruct\mapstruct\1.2.0.Final\mapstruct-1.2.0.Final.jar;D:\fshare\re\org\springframework\boot\spring-boot-starter\2.3.2.RELEASE\spring-boot-starter-2.3.2.RELEASE.jar;D:\fshare\re\org\springframework\boot\spring-boot\2.3.2.RELEASE\spring-boot-2.3.2.RELEASE.jar;D:\fshare\re\org\springframework\boot\spring-boot-autoconfigure\2.3.2.RELEASE\spring-boot-autoconfigure-2.3.2.RELEASE.jar;D:\fshare\re\org\springframework\boot\spring-boot-starter-logging\2.3.2.RELEASE\spring-boot-starter-logging-2.3.2.RELEASE.jar;D:\fshare\re\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\fshare\re\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\fshare\re\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;D:\fshare\re\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;D:\fshare\re\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;D:\fshare\re\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\fshare\re\org\springframework\spring-core\5.2.8.RELEASE\spring-core-5.2.8.RELEASE.jar;D:\fshare\re\org\springframework\spring-jcl\5.2.8.RELEASE\spring-jcl-5.2.8.RELEASE.jar;D:\fshare\re\org\yaml\snakeyaml\1.26\snakeyaml-1.26.jar" starter.SwaggerApplication
Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationListener : org.springframework.boot.context.logging.ClasspathLoggingApplicationListener
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:445)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:427)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:420)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:273)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:253)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at starter.SwaggerApplication.main(SwaggerApplication.java:16)
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/event/GenericApplicationListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
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:348)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:284)
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:438)
... 7 more
Caused by: java.lang.ClassNotFoundException: org.springframework.context.event.GenericApplicationListener
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)
... 23 more
Process finished with exit code 1
根据提示去maven中查看
jar包冲突了
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<exclusions>
<exclusion>
<artifactId>spring-context</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
</exclusions>
</dependency>
但运行后又有新问题,这是springfox-swagger2版本低,如果闲麻烦可以提升版本,不然手动排除冲突jar
"C:\Program Files\Java\jdk1.8.0_221\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2020.2\lib\idea_rt.jar=35628:C:\Program Files\JetBrains\IntelliJ IDEA 2020.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_221\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\rt.jar;C:\Users\Administrator\Documents\workspace\shop_platform\swagger\target\classes;D:\fshare\re\com\spring4all\swagger-spring-boot-starter\1.9.0.RELEASE\swagger-spring-boot-starter-1.9.0.RELEASE.jar;D:\fshare\re\io\springfox\springfox-swagger-ui\2.9.2\springfox-swagger-ui-2.9.2.jar;D:\fshare\re\io\springfox\springfox-bean-validators\2.9.2\springfox-bean-validators-2.9.2.jar;D:\fshare\re\io\springfox\springfox-swagger2\2.9.2\springfox-swagger2-2.9.2.jar;D:\fshare\re\io\swagger\swagger-annotations\1.5.20\swagger-annotations-1.5.20.jar;D:\fshare\re\io\swagger\swagger-models\1.5.20\swagger-models-1.5.20.jar;D:\fshare\re\com\fasterxml\jackson\core\jackson-annotations\2.9.5\jackson-annotations-2.9.5.jar;D:\fshare\re\io\springfox\springfox-spi\2.9.2\springfox-spi-2.9.2.jar;D:\fshare\re\io\springfox\springfox-core\2.9.2\springfox-core-2.9.2.jar;D:\fshare\re\net\bytebuddy\byte-buddy\1.8.12\byte-buddy-1.8.12.jar;D:\fshare\re\io\springfox\springfox-schema\2.9.2\springfox-schema-2.9.2.jar;D:\fshare\re\io\springfox\springfox-swagger-common\2.9.2\springfox-swagger-common-2.9.2.jar;D:\fshare\re\io\springfox\springfox-spring-web\2.9.2\springfox-spring-web-2.9.2.jar;D:\fshare\re\com\google\guava\guava\20.0\guava-20.0.jar;D:\fshare\re\com\fasterxml\classmate\1.4.0\classmate-1.4.0.jar;D:\fshare\re\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\fshare\re\org\springframework\plugin\spring-plugin-core\1.2.0.RELEASE\spring-plugin-core-1.2.0.RELEASE.jar;D:\fshare\re\org\springframework\spring-beans\4.0.9.RELEASE\spring-beans-4.0.9.RELEASE.jar;D:\fshare\re\org\springframework\spring-aop\4.0.9.RELEASE\spring-aop-4.0.9.RELEASE.jar;D:\fshare\re\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;D:\fshare\re\org\springframework\plugin\spring-plugin-metadata\1.2.0.RELEASE\spring-plugin-metadata-1.2.0.RELEASE.jar;D:\fshare\re\org\mapstruct\mapstruct\1.2.0.Final\mapstruct-1.2.0.Final.jar;D:\fshare\re\org\springframework\boot\spring-boot-starter\2.3.2.RELEASE\spring-boot-starter-2.3.2.RELEASE.jar;D:\fshare\re\org\springframework\boot\spring-boot\2.3.2.RELEASE\spring-boot-2.3.2.RELEASE.jar;D:\fshare\re\org\springframework\spring-context\5.2.8.RELEASE\spring-context-5.2.8.RELEASE.jar;D:\fshare\re\org\springframework\spring-expression\5.2.8.RELEASE\spring-expression-5.2.8.RELEASE.jar;D:\fshare\re\org\springframework\boot\spring-boot-autoconfigure\2.3.2.RELEASE\spring-boot-autoconfigure-2.3.2.RELEASE.jar;D:\fshare\re\org\springframework\boot\spring-boot-starter-logging\2.3.2.RELEASE\spring-boot-starter-logging-2.3.2.RELEASE.jar;D:\fshare\re\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\fshare\re\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\fshare\re\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;D:\fshare\re\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;D:\fshare\re\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;D:\fshare\re\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\fshare\re\org\springframework\spring-core\5.2.8.RELEASE\spring-core-5.2.8.RELEASE.jar;D:\fshare\re\org\springframework\spring-jcl\5.2.8.RELEASE\spring-jcl-5.2.8.RELEASE.jar;D:\fshare\re\org\yaml\snakeyaml\1.26\snakeyaml-1.26.jar" starter.SwaggerApplication
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:1237)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at starter.SwaggerApplication.main(SwaggerApplication.java:16)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.boot.context.event.EventPublishingRunListener]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.aop.framework.AopProxyUtils.getSingletonTarget(Ljava/lang/Object;)Ljava/lang/Object;
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:164)
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:441)
... 6 more
Caused by: java.lang.NoSuchMethodError: org.springframework.aop.framework.AopProxyUtils.getSingletonTarget(Ljava/lang/Object;)Ljava/lang/Object;
at org.springframework.context.event.AbstractApplicationEventMulticaster.addApplicationListener(AbstractApplicationEventMulticaster.java:110)
at org.springframework.boot.context.event.EventPublishingRunListener.<init>(EventPublishingRunListener.java:63)
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:148)
... 7 more
Process finished with exit code 1