I am relatively new to Gradle
and the SpringBoot
plugin.
I am trying to create a SpringBoot
WAR file with Jetty
as the container.
I am using SpringBoot 2.0.2.RELEASE
with spring-boot-starter-jetty
which bring in Spring 5.0.6.RELEASE and Jetty 9.4.10.v20180503 (which as far as I can tell are compatible).
I don't see any version inconsistencies in my WAR file but when run the assembled bootWar, I get the following exception:
[2018-05-11T18:28:09,432 ERROR main SpringApplication ] Application run failed org.springframework.boot.web.server.WebServerException: Unable to start embedded Jetty server at org.springframework.boot.web.embedded.jetty.JettyWebServer.start(JettyWebServer.java:167) ~[spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:300) ~[spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-4.3.12.RELEASE.jar!/:4.3.12.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at com.focusvq.fts.spring.Application.main(Application.java:17) [classes!/:1.0] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_101] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_101] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_101] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [fts-data-1.0.war:1.0] at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [fts-data-1.0.war:1.0] at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [fts-data-1.0.war:1.0] at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:58) [fts-data-1.0.war:1.0] Caused by: javax.servlet.ServletException: dispatcherServlet@7ef5559e==org.springframework.web.servlet.DispatcherServlet,jsp=null,order=-1,inst=false at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:691) ~[jetty-servlet-9.4.10.v20180503.jar!/:9.4.10.v20180503] at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:427) ~[jetty-servlet-9.4.10.v20180503.jar!/:9.4.10.v20180503] at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:760) ~[jetty-servlet-9.4.10.v20180503.jar!/:9.4.10.v20180503] at org.springframework.boot.web.embedded.jetty.JettyEmbeddedWebAppContext$JettyEmbeddedServletHandler.deferredInitialize(JettyEmbeddedWebAppContext.java:46) ~[spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.boot.web.embedded.jetty.JettyEmbeddedWebAppContext.deferredInitialize(JettyEmbeddedWebAppContext.java:36) ~[spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.boot.web.embedded.jetty.JettyWebServer.handleDeferredInitialize(JettyWebServer.java:209) ~[spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.boot.web.embedded.jetty.JettyWebServer.start(JettyWebServer.java:141) ~[spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] ... 18 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping': Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.web.servlet.handler.AbstractHandlerMapping.obtainApplicationContext()Lorg/springframework/context/ApplicationContext; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:587) ~[spring-beans-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:303) ~[spring-beans-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.createDefaultStrategy(DispatcherServlet.java:879) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.getDefaultStrategies(DispatcherServlet.java:847) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.initHandlerMappings(DispatcherServlet.java:606) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:501) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:490) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:561) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:499) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:172) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at javax.servlet.GenericServlet.init(GenericServlet.java:244) ~[javax.servlet-api-3.1.0.jar!/:3.1.0] at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:670) ~[jetty-servlet-9.4.10.v20180503.jar!/:9.4.10.v20180503] at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:427) ~[jetty-servlet-9.4.10.v20180503.jar!/:9.4.10.v20180503] at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:760) ~[jetty-servlet-9.4.10.v20180503.jar!/:9.4.10.v20180503] at org.springframework.boot.web.embedded.jetty.JettyEmbeddedWebAppContext$JettyEmbeddedServletHandler.deferredInitialize(JettyEmbeddedWebAppContext.java:46) ~[spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.boot.web.embedded.jetty.JettyEmbeddedWebAppContext.deferredInitialize(JettyEmbeddedWebAppContext.java:36) ~[spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.boot.web.embedded.jetty.JettyWebServer.handleDeferredInitialize(JettyWebServer.java:209) ~[spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.boot.web.embedded.jetty.JettyWebServer.start(JettyWebServer.java:141) ~[spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] ... 18 more Caused by: java.lang.NoSuchMethodError: org.springframework.web.servlet.handler.AbstractHandlerMapping.obtainApplicationContext()Lorg/springframework/context/ApplicationContext; at org.springframework.web.servlet.handler.AbstractHandlerMapping.detectMappedInterceptors(AbstractHandlerMapping.java:269) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.handler.AbstractHandlerMapping.initApplicationContext(AbstractHandlerMapping.java:243) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping.initApplicationContext(AbstractDetectingUrlHandlerMapping.java:58) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:120) ~[spring-context-4.3.12.RELEASE.jar!/:4.3.12.RELEASE] at org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:77) ~[spring-web-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:74) ~[spring-context-4.3.12.RELEASE.jar!/:4.3.12.RELEASE] at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:121) ~[spring-context-4.3.12.RELEASE.jar!/:4.3.12.RELEASE] at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:97) ~[spring-context-4.3.12.RELEASE.jar!/:4.3.12.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:422) ~[spring-beans-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1698) ~[spring-beans-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579) ~[spring-beans-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:303) ~[spring-beans-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.createDefaultStrategy(DispatcherServlet.java:879) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.getDefaultStrategies(DispatcherServlet.java:847) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.initHandlerMappings(DispatcherServlet.java:606) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:501) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:490) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:561) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:499) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:172) ~[spring-webmvc-5.0.6.RELEASE.jar!/:5.0.6.RELEASE] at javax.servlet.GenericServlet.init(GenericServlet.java:244) ~[javax.servlet-api-3.1.0.jar!/:3.1.0] at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:670) ~[jetty-servlet-9.4.10.v20180503.jar!/:9.4.10.v20180503] at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:427) ~[jetty-servlet-9.4.10.v20180503.jar!/:9.4.10.v20180503] at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:760) ~[jetty-servlet-9.4.10.v20180503.jar!/:9.4.10.v20180503] at org.springframework.boot.web.embedded.jetty.JettyEmbeddedWebAppContext$JettyEmbeddedServletHandler.deferredInitialize(JettyEmbeddedWebAppContext.java:46) ~[spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.boot.web.embedded.jetty.JettyEmbeddedWebAppContext.deferredInitialize(JettyEmbeddedWebAppContext.java:36) ~[spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.boot.web.embedded.jetty.JettyWebServer.handleDeferredInitialize(JettyWebServer.java:209) ~[spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] at org.springframework.boot.web.embedded.jetty.JettyWebServer.start(JettyWebServer.java:141) ~[spring-boot-2.0.2.RELEASE.jar!/:2.0.2.RELEASE] ... 18 more
It is loading version 5.0.6.RELEASE
of org.springframework.web.servlet.handler.AbstractHandlerMapping
which indeed does not have an obtainApplicationContext
method.
I have had to turn off MongoAutoConfiguration
and WebMvcAutoConfiguration
to get to this point but turning off EmbeddedWebServerFactoryCustomizerAutoConfiguration
doesn't appear to help. Can anyone shed some insight into where I might be amiss?