時,我得到一個NullPointerException飄飛在我的嵌入式碼頭應用:的NullPointerException嵌入式碼頭使用JMX
java.lang.reflect.InvocationTargetException
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:498)
at org.eclipse.jetty.jmx.ObjectMBean.getAttribute(ObjectMBean.java:349)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:647)
at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1445)
...
Caused by: java.lang.NullPointerException
at org.eclipse.jetty.server.handler.ContextHandler.isShutdown(ContextHandler.java:682)
... 28 more
我已經設置了JMX這樣的:
Server server = new Server();
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
MBeanContainer mbContainer = new MBeanContainer(mBeanServer);
server.addBean(mbContainer);
出現這種情況隨機(並不總是)在服務器啓動時,並且只有當我的Prometheous JMX Exporter在同一臺機器上運行時,最有可能在Jetty尚未準備好處理連接的階段連接到JMX服務器。
任何想法如何解決這個問題?
碼頭的哪個版本是這個。 ? –