web-dev-qa-db-ja.com

Tomcat Tomcat / 9.0.8エラーJava.lang.NoClassDefFoundError:javax / management / MBeanServerNotification

Java Springアプリケーションを起動すると次のエラーが発生します

> `16-Jul-2018 12:00:02.108 WARNING [http-nio-8080-exec-4] org.Apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [partner4] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 Java.lang.Object.wait(Native Method)
 Java.lang.ref.ReferenceQueue.remove(ReferenceQueue.Java:143)
 com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.Java:64)
 Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1149)
 Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:624)
 Java.lang.Thread.run(Thread.Java:748)
16-Jul-2018 12:00:02.145 SEVERE [http-nio-8080-exec-4] org.Apache.catalina.loader.WebappLoader.startInternal LifecycleException 
 Java.lang.NoClassDefFoundError: javax/management/MBeanServerNotification
    at io.micrometer.core.instrument.binder.Tomcat.TomcatMetrics.lambda$registerMetricsEventually$bca24a20$1(TomcatMetrics.Java:225)
    at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.Java:238)
    at javax.management.MBeanServerDelegate.sendNotification(MBeanServerDelegate.Java:209)
    at com.Sun.jmx.interceptor.DefaultMBeanServerInterceptor.sendNotification(DefaultMBeanServerInterceptor.Java:1498)
    at com.Sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.Java:1911)
    at com.Sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.Java:966)
    at com.Sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.Java:900)
    at com.Sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.Java:324)
    at com.Sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.Java:522)
    at org.Apache.Tomcat.util.modeler.Registry.registerComponent(Registry.Java:632)
    at org.Apache.catalina.loader.WebappLoader.startInternal(WebappLoader.Java:408)
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:183)
    at org.Apache.catalina.core.StandardContext.startInternal(StandardContext.Java:4939)
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:183)
    at org.Apache.catalina.manager.ManagerServlet.start(ManagerServlet.Java:1395)
    at org.Apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.Java:698)
    at org.Apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.Java:223)
    at javax.servlet.http.HttpServlet.service(HttpServlet.Java:660)
    at javax.servlet.http.HttpServlet.service(HttpServlet.Java:741)
    at org.Apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.Java:231)
    at org.Apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.Java:166)
    at org.Apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.Java:136)
    at org.Apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.Java:193)
    at org.Apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.Java:166)
    at org.Apache.Tomcat.websocket.server.WsFilter.doFilter(WsFilter.Java:53)
    at org.Apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.Java:193)
    at org.Apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.Java:166)
    at org.Apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.Java:199)
    at org.Apache.catalina.core.StandardContextValve.invoke(StandardContextValve.Java:96)
    at org.Apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.Java:611)
    at org.Apache.catalina.core.StandardHostValve.invoke(StandardHostValve.Java:139)
    at org.Apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.Java:92)
    at org.Apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.Java:651)
    at org.Apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.Java:87)
    at org.Apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.Java:343)
    at org.Apache.coyote.http11.Http11Processor.service(Http11Processor.Java:412)
    at org.Apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.Java:66)
    at org.Apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.Java:754)
    at org.Apache.Tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.Java:1385)
    at org.Apache.Tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.Java:49)
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1149)
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:624)
    at org.Apache.Tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.Java:61)
    at Java.lang.Thread.run(Thread.Java:748)

16-Jul-2018 12:00:07.106 INFO [Abandoned connection cleanup thread] org.Apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
 Java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
    at org.Apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.Java:1312)
    at org.Apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.Java:989)
    at com.mysql.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders(AbandonedConnectionCleanupThread.Java:90)
    at com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.Java:63)
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1149)
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:624)
    at Java.lang.Thread.run(Thread.Java:748)

16-Jul-2018 12:00:26.596 INFO [Service Thread] org.Apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load [javax.management.openmbean.CompositeData]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
 Java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [javax.management.openmbean.CompositeData]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
    at org.Apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.Java:1312)
    at org.Apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.Java:1300)
    at org.Apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.Java:1159)
    at org.Apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.Java:1121)
    at io.micrometer.core.instrument.binder.jvm.JvmGcMetrics.lambda$bindTo$0(JvmGcMetrics.Java:139)
    at Sun.management.NotificationEmitterSupport.sendNotification(NotificationEmitterSupport.Java:156)
    at Sun.management.GarbageCollectorImpl.createGCNotification(GarbageCollectorImpl.Java:143)

16-Jul-2018 12:00:30.206 WARNING [http-nio-8080-exec-14] org.Apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [partner4] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 Java.lang.Object.wait(Native Method)
 Java.lang.ref.ReferenceQueue.remove(ReferenceQueue.Java:143)
 com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.Java:64)
 Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1149)
 Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:624)
 Java.lang.Thread.run(Thread.Java:748)
16-Jul-2018 12:00:30.242 SEVERE [http-nio-8080-exec-14] org.Apache.catalina.loader.WebappLoader.startInternal LifecycleException 
 Java.lang.NoClassDefFoundError: javax/management/MBeanServerNotification
    at io.micrometer.core.instrument.binder.Tomcat.TomcatMetrics.lambda$registerMetricsEventually$bca24a20$1(TomcatMetrics.Java:225)
    at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.Java:238)
    at javax.management.MBeanServerDelegate.sendNotification(MBeanServerDelegate.Java:209)
    at com.Sun.jmx.interceptor.DefaultMBeanServerInterceptor.sendNotification(DefaultMBeanServerInterceptor.Java:1498)
    at com.Sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.Java:1911)
    at com.Sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.Java:966)
    at com.Sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.Java:900)
    at com.Sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.Java:324)
    at com.Sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.Java:522)
    at org.Apache.Tomcat.util.modeler.Registry.registerComponent(Registry.Java:632)
    at org.Apache.catalina.loader.WebappLoader.startInternal(WebappLoader.Java:408)
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:183)
    at org.Apache.catalina.core.StandardContext.startInternal(StandardContext.Java:4939)
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:183)
    at org.Apache.catalina.manager.ManagerServlet.start(ManagerServlet.Java:1395)
    at org.Apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.Java:698)
    at org.Apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.Java:223)
    at javax.servlet.http.HttpServlet.service(HttpServlet.Java:660)
    at javax.servlet.http.HttpServlet.service(HttpServlet.Java:741)
    at org.Apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.Java:231)
    at org.Apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.Java:166)
    at org.Apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.Java:136)
    at org.Apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.Java:193)
    at org.Apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.Java:166)
    at org.Apache.Tomcat.websocket.server.WsFilter.doFilter(WsFilter.Java:53)
    at org.Apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.Java:193)
    at org.Apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.Java:166)
    at org.Apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.Java:199)
    at org.Apache.catalina.core.StandardContextValve.invoke(StandardContextValve.Java:96)
    at org.Apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.Java:611)
    at org.Apache.catalina.core.StandardHostValve.invoke(StandardHostValve.Java:139)
    at org.Apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.Java:92)
    at org.Apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.Java:651)
    at org.Apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.Java:87)
    at org.Apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.Java:343)
    at org.Apache.coyote.http11.Http11Processor.service(Http11Processor.Java:412)
    at org.Apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.Java:66)
    at org.Apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.Java:754)
    at org.Apache.Tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.Java:1385)
    at org.Apache.Tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.Java:49)
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1149)
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:624)
    at org.Apache.Tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.Java:61)
    at Java.lang.Thread.run(Thread.Java:748)

16-Jul-2018 12:00:35.204 INFO [Abandoned connection cleanup thread] org.Apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
 Java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
    at org.Apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.Java:1312)
    at org.Apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.Java:989)
    at com.mysql.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders(AbandonedConnectionCleanupThread.Java:90)
    at com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.Java:63)
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1149)
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:624)
    at Java.lang.Thread.run(Thread.Java:748)`

サーバーはLinuxcentos7でjdk1.8.0_171-b10を使用しています。Tomcat/ 9.0.8私はSpringBootv2.0.0.RELEASEを使用しています。

私の開発環境はjdk1.8.0_131Tomcat/8.0.52 windows10です。

助けてください、これは私の初めてのSpringアプリケーションのデプロイです。

1
Ian Nato

Tomcat 9/Unixにアプリケーションをデプロイしているときに、同じ問題に直面していました。 Java_OPTSsetenv.shエントリが間違っていたため、Tomcatはjavax.management.MBeanServerNotificationクラスを見つけることができませんでした。私はそれを修正し、それが機能し始めました。

不正解:(Tomcat/windowsの場合は正しい)

Java_OPTS="%Java_OPTS% -Dspring.profiles.active=dev"

正解:(Tomcat/windowsでは不正解)

Java_OPTS="$Java_OPTS -Dspring.profiles.active=dev"
1
ChetanK