Spring Boot 如何修复引起:“java.lang.NoClassDefFoundError:javax/management/MBeanServerNotification”on tomcat deployment 8.5.27

roqulrg3  于 2023-10-16  发布在  Spring
关注(0)|答案(1)|浏览(107)

我在本地部署了我的项目在tomcat 9服务器上,它工作得很好,但是当我尝试在远程部署服务器上使用tomcat 8.5.27时,它抛出了以下错误:

20-Jul-2019 11:26:43.039 SEVERE [localhost-startStop-27] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
     org.apache.catalina.LifecycleException: Failed to initialize component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Stream]]
            at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:113)
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
            at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986)
            at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
            at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
            at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
            at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
            at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
            at java.base/java.lang.Thread.run(Thread.java:844)
    Caused by: java.lang.NoClassDefFoundError: javax/management/MBeanServerNotification
            at io.micrometer.core.instrument.binder.tomcat.TomcatMetrics.lambda$registerMetricsEventually$aa4da135$1(TomcatMetrics.java:259)
            at java.management/javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:238)
            at java.management/javax.management.MBeanServerDelegate.sendNotification(MBeanServerDelegate.java:211)
            at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.sendNotification(DefaultMBeanServerInterceptor.java:1473)
            at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1867)
            at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:955)
            at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:890)
            at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:320)
            at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
            at org.apache.tomcat.util.modeler.Registry.registerComponent(Registry.java:634)
            at org.apache.catalina.util.LifecycleMBeanBase.register(LifecycleMBeanBase.java:161)
            at org.apache.catalina.util.LifecycleMBeanBase.initInternal(LifecycleMBeanBase.java:61)
            at org.apache.catalina.core.ContainerBase.initInternal(ContainerBase.java:903)
            at org.apache.catalina.core.StandardContext.initInternal(StandardContext.java:6228)
            at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
            ... 11 more

    20-Jul-2019 11:26:43.040 SEVERE [localhost-startStop-27] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive [/home/webadmin/server/apache-tomcat-8.5.27/webapps/Stream.war]
     java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to initialize component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Stream]]
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:756)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
            at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986)
            at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
            at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
            at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
            at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
            at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
            at java.base/java.lang.Thread.run(Thread.java:844)

我用的是java 1.8和springboot 2.1.2。直到昨天,代码在远程服务器上部署并正常运行,直到今天我才得到这个错误。在我的本地系统与tomcat9它仍然正常工作。我没有其他依赖项被添加到eclipse的构建路径中。
请告诉我此错误的原因和解决方法。先谢了。

bvjxkvbb

bvjxkvbb1#

我有一个在Eclipse IDE中开发的Tomcat Maven+Sping Boot 项目。作为应用程序服务器,我在本例中使用了Tomcat 9.0.35。
我得到了同样的错误

Caused by:java.lang.NoClassDefFoundError: javax/management/MBeanServerNotification

当我在远程主机服务器上部署这个应用程序时。应用程序在本地服务器上运行时没有错误。两台服务器上的操作系统都是Ubuntu 22.04。
我通过以下步骤摆脱了这个错误:
1.我在远程服务器上重新启动了Tomcat。
1.我在远程服务器上取消了此应用程序的部署。
1.我把它的war文件移到了/opt/tomcat/latest/webapps文件夹。
1.每次我尝试的时候都是这样。
然而,我总是得到上述错误时,跳过步骤1。当我在Tomcat管理器中按下这个应用程序旁边的开始按钮而没有按照上面的步骤操作时,我也得到了这个错误。
也许更新或升级Tomcat会使上述步骤变得不必要?有些人提到的其他解决方案在这种情况下不起作用。

相关问题