报错:
org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Jetty servlet container
at org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainer.start(JettyEmbeddedServletContainer.java:163)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at com.xuanwu.ump.web.StartServer.main(StartServer.java:26)
Caused by: MultiException[javax.servlet.ServletException: java.lang.NullPointerException, javax.servlet.ServletException: default==org.eclipse.jetty.servlet.DefaultServlet@5c13d641{jsp=null,order=1,inst=true,async=true,src=EMBEDDED:null,STARTED}]
at org.eclipse.jetty.util.MultiException.ifExceptionThrow(MultiException.java:122)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:776)
at org.springframework.boot.context.embedded.jetty.JettyEmbeddedWebAppContext$JettyEmbeddedServletHandler.deferredInitialize(JettyEmbeddedWebAppContext.java:46)
at org.springframework.boot.context.embedded.jetty.JettyEmbeddedWebAppContext.deferredInitialize(JettyEmbeddedWebAppContext.java:36)
at org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainer.handleDeferredInitialize(JettyEmbeddedServletContainer.java:207)
at org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainer.start(JettyEmbeddedServletContainer.java:138)
... 10 more
Suppressed: javax.servlet.ServletException: java.lang.NullPointerException
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.init(WebSocketUpgradeFilter.java:461)
at org.eclipse.jetty.servlet.FilterHolder.initialize(FilterHolder.java:140)
at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$0(ServletHandler.java:750)
at org.eclipse.jetty.servlet.ServletHandler$$Lambda$43/371605426.accept(Unknown Source)
at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:742)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:774)
... 14 more
Caused by: java.lang.NullPointerException
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.init(WebSocketUpgradeFilter.java:398)
... 21 more
Suppressed: javax.servlet.ServletException: default==org.eclipse.jetty.servlet.DefaultServlet@5c13d641{jsp=null,order=1,inst=true,async=true,src=EMBEDDED:null,STARTED}
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:650)
at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:415)
at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$0(ServletHandler.java:750)
at org.eclipse.jetty.servlet.ServletHandler$$Lambda$43/371605426.accept(Unknown Source)
at java.util.stream.StreamSpliterators$WrappingSpliterator$$Lambda$46/1989511207.accept(Unknown Source)
at java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:352)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)
at java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312)
at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:743)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:774)
... 14 more
Caused by: java.lang.NullPointerException
at org.eclipse.jetty.servlet.DefaultServlet.initContextHandler(DefaultServlet.java:359)
at org.eclipse.jetty.servlet.DefaultServlet.init(DefaultServlet.java:168)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:632)
... 25 more
[CIRCULAR REFERENCE:javax.servlet.ServletException: java.lang.NullPointerException]
二月 15, 2023 10:15:39 上午 org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext doClose
信息: Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@56e07a08: startup date [Wed Feb 15 10:14:14 CST 2023]; root of context hierarchy
二月 15, 2023 10:15:39 上午 org.springframework.jmx.export.annotation.AnnotationMBeanExporter destroy
信息: Unregistering JMX-exposed beans on shutdown
二月 15, 2023 10:15:39 上午 org.springframework.jmx.export.annotation.AnnotationMBeanExporter unregisterBeans
信息: Unregistering JMX-exposed beans
二月 15, 2023 10:15:39 上午 com.xuanwu.ump.web.job.TaskExecutor shutdown
信息: Shutting down ExecutorService 'taskExecutor'
二月 15, 2023 10:15:39 上午 org.apache.commons.dbcp2.BasicDataSource close
警告: Failed to unregister the JMX name: org.apache.commons.dbcp2:name=listDataSource,type=BasicDataSource
javax.management.InstanceNotFoundException: org.apache.commons.dbcp2:name=listDataSource,type=BasicDataSource
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1095)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.exclusiveUnregisterMBean(DefaultMBeanServerInterceptor.java:427)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.unregisterMBean(DefaultMBeanServerInterceptor.java:415)
at com.sun.jmx.mbeanserver.JmxMBeanServer.unregisterMBean(JmxMBeanServer.java:546)
at org.apache.commons.dbcp2.BasicDataSource.close(BasicDataSource.java:1917)
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:497)
at org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod(DisposableBeanAdapter.java:364)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:287)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:583)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:555)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:957)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:516)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:964)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1034)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1009)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:958)
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:750)
at
排查思路:定位到空指针异常的地方,发现这里config.getServletContext()为空,
configuration也为空,正常来讲configuration应该是启动容器注入,不应该为空
所以定位到包,发现包的版本与其他项目的版本不一致
定位maven,发现是jetty包下的,所以修改jetty版本
顺利启动