报错:Failed to start bean ‘webServerStartStop’; nested exception is java.lang.NoClassDefFoundError: org/wildfly/common/net/CidrAddressTable

启动项目报错如下:

在这里插入图片描述


报错:

2022-09-08 11:49:29 [main] INFO  c.b.d.d.DynamicRoutingDataSource
 - dynamic-datasource all closed success,bye
2022-09-08 11:49:29 [main] ERROR o.s.boot.SpringApplication
 - Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is java.lang.NoClassDefFoundError: org/wildfly/common/net/CidrAddressTable
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181)
	at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)
	at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
	at org.springframework.context.support.DefaultLifecycleProcessor$$Lambda$1341/7788116.accept(Unknown Source)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155)
	at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:763)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:339)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1318)
	at com.skeqi.SQApplication.main(SQApplication.java:16)
	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:483)
	at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:64)
Caused by: java.lang.NoClassDefFoundError: org/wildfly/common/net/CidrAddressTable
	at org.xnio.XnioWorker$Builder.<init>(XnioWorker.java:1040)
	at org.xnio.Xnio.createWorkerBuilder(Xnio.java:430)
	at org.xnio.Xnio.createWorker(Xnio.java:477)
	at org.xnio.Xnio.createWorker(Xnio.java:463)
	at org.xnio.Xnio.createWorker(Xnio.java:450)
	at io.undertow.Undertow.start(Undertow.java:125)
	at org.springframework.boot.web.embedded.undertow.UndertowWebServer.start(UndertowWebServer.java:130)
	at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:43)
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
	... 21 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.wildfly.common.net.CidrAddressTable
	at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 30 common frames omitted

Process finished with exit code 1


原因分析:

分析猜想:1、pom文件缺少依赖 2、找不到webServerStartStop的bean

全局搜org.wildfly.common 发现在pom文件中,其被排除了;奇怪,我没有手动加exclusions,噢,可能是因为之前选中想要忽略的类右键->Mark Derictory as -> excluded时,idea自动加了exclusion


解决方案:

提示:这里填写该问题的具体解决方案:

在pom.xml中注释或者删除exclusions:

<!--            <exclusions>-->
<!--                <exclusion>-->
<!--                    <artifactId>wildfly-common</artifactId>-->
<!--                    <groupId>org.wildfly.common</groupId>-->
<!--                </exclusion>-->
<!--            </exclusions>-->
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐