java.lang.NoSuchMethodError: javax.servlet.ServletContext.addServlet(Ljava/lang/String;Ljavax/servlet/Servlet;)

IT黑名单 2017-12-8 14:36:13

Unable to start embedded container; nested exception is java.lang.NoSuchMethodError: javax.servlet.ServletContext.addServlet(Ljava/lang/String;Ljavax/servlet/Servlet;)Ljavax/servlet/ServletRegistration$Dynamic;
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:535) ~[spring-context-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at com.mama100.site.snsec.expert.Application.main(Application.java:28) [classes!/:1.1.2-SNAPSHOT]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_45]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_45]
	at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_45]
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [snsec-expert-1.1.2-SNAPSHOT.jar:1.1.2-SNAPSHOT]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [snsec-expert-1.1.2-SNAPSHOT.jar:1.1.2-SNAPSHOT]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [snsec-expert-1.1.2-SNAPSHOT.jar:1.1.2-SNAPSHOT]
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58) [snsec-expert-1.1.2-SNAPSHOT.jar:1.1.2-SNAPSHOT]
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.addServlet(Ljava/lang/String;Ljavax/servlet/Servlet;)Ljavax/servlet/ServletRegistration$Dynamic;
	at org.springframework.boot.web.servlet.ServletRegistrationBean.onStartup(ServletRegistrationBean.java:191) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.selfInitialize(EmbeddedWebApplicationContext.java:229) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.access$000(EmbeddedWebApplicationContext.java:89) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext$1.onStartup(EmbeddedWebApplicationContext.java:213) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.springframework.boot.context.embedded.jetty.ServletContextInitializerConfiguration$Initializer.callInitializers(ServletContextInitializerConfiguration.java:83) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.springframework.boot.context.embedded.jetty.ServletContextInitializerConfiguration$Initializer.doStart(ServletContextInitializerConfiguration.java:72) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) ~[jetty-util-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132) ~[jetty-util-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:106) ~[jetty-util-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61) ~[jetty-server-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.server.handler.ScopedHandler.doStart(ScopedHandler.java:120) ~[jetty-server-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:809) ~[jetty-server-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:345) ~[jetty-servlet-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1404) ~[jetty-webapp-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1366) ~[jetty-webapp-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:778) ~[jetty-server-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:262) ~[jetty-servlet-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:520) ~[jetty-webapp-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) ~[jetty-util-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132) ~[jetty-util-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.server.Server.start(Server.java:411) ~[jetty-server-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:106) ~[jetty-util-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61) ~[jetty-server-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.server.Server.doStart(Server.java:378) ~[jetty-server-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) ~[jetty-util-9.3.11.v20160721.jar!/:9.3.11.v20160721]
	at org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainer.initialize(JettyEmbeddedServletContainer.java:91) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainer.<init>(JettyEmbeddedServletContainer.java:79) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory.getJettyEmbeddedServletContainer(JettyEmbeddedServletContainerFactory.java:540) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory.getEmbeddedServletContainer(JettyEmbeddedServletContainerFactory.java:185) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
	... 16 more

jar包冲突,javaee-api-*.jar  javax.servlet-api-*.jar  servlet-api-*.jar  三个jar中都有javax.servlet.ServletContext,根据需要选择其中一个,并排除不需要的


转载请注明来源【IT黑名单

本文链接:http://blog.itblacklist.cn/20171208/8463.html

© Copyright 2016 IT黑名单 Inc.All Rights Reserved. 豫ICP备15018592号-2