I am getting following log when i run the Spring boot application. it shows like Correct the classpath of your application so that it contains a single, compatible version of javax.servlet.ServletContext
Log
"C:\Program Files\Java\jdk1.8.0_221\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.3.6\lib\idea_rt.jar=49832:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.3.6\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_221\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\access-bridge.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\rt.jar;F:\bookShop\bookShop\out\production\classes;F:\bookShop\bookShop\out\production\resources;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jdbc\2.0.6\2d207c40d0d29941858093aa830362d60a4f7e0e\spring-jdbc-2.0.6.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework\spring-tx\5.2.0.RELEASE\630fdb60bb48ceb7274fbf69b4082a0b5d684bc0\spring-tx-5.2.0.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-web\2.2.1.RELEASE\689213aca6e25e2aa9b377e61273aa3d31f30f60\spring-boot-starter-web-2.2.1.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework\spring-dao\2.0.6\facdcd4a06cd1a1b516aef8bf8f2188843ac5df1\spring-dao-2.0.6.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\commons-logging\commons-logging\1.1\ba24d5de831911b684c92cd289ed5ff826271824\commons-logging-1.1.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\mysql\mysql-connector-java\8.0.18\e088efaa4b568bc7d9f7274b9c5ea1a00da1a45c\mysql-connector-java-8.0.18.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework\spring-webmvc\5.2.1.RELEASE\9c118e3a551fe4bf31eb9e395b5f8ef42cf14f42\spring-webmvc-5.2.1.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-json\2.2.1.RELEASE\2d9f5ad8a76edcf3c610e0f825d9c01563a6900a\spring-boot-starter-json-2.2.1.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-validation\2.2.1.RELEASE\ea5bd9055951afe28f64a96524bfd0bf0d362313\spring-boot-starter-validation-2.2.1.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter\2.2.1.RELEASE\5a4d687e6ffec805ce6320af7ca0b18798638200\spring-boot-starter-2.2.1.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-autoconfigure\2.2.1.RELEASE\1e45b519cc3b1de0b1ecee6eed6397c19ede95a2\spring-boot-autoconfigure-2.2.1.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot\2.2.1.RELEASE\3acb07ca9d6b968209a91aec6a7751f35bf22764\spring-boot-2.2.1.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework\spring-context\5.2.1.RELEASE\1d3e142adbdbd0810b19462fbd88d94cc51cce01\spring-context-5.2.1.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework\spring-web\5.2.1.RELEASE\4f1dfe592951c312b52de469f1940b1cb0455226\spring-web-5.2.1.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework\spring-aop\5.2.1.RELEASE\34c11ad92e06753e592865c7c403b09ab884d862\spring-aop-5.2.1.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework\spring-beans\5.2.1.RELEASE\d05690257d8e8034b180db3893d5baf8250fb9d3\spring-beans-5.2.1.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework\spring-expression\5.2.1.RELEASE\499e91096320f7e6fcfd6920e66d5ed5f0ecfee9\spring-expression-5.2.1.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework\spring-core\5.2.1.RELEASE\32b265ff5c7c35257b5a242b9628dcd321a2b010\spring-core-5.2.1.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-tomcat\2.2.1.RELEASE\da314ec9026c230906ea9d1a1330f99bbe2d0fa8\spring-boot-starter-tomcat-2.2.1.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\log4j\log4j\1.2.12\57b8740427ee6d7b0b60792751356cad17dc0d9\log4j-1.2.12.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\logkit\logkit\1.0.1\aaf5649b523c5ffc925e746074979150bb74bfdc\logkit-1.0.1.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\avalon-framework\avalon-framework\4.1.3\92315ee1c4a4c90bee05055713811f28f8509075\avalon-framework-4.1.3.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\javax.servlet\servlet-api\2.3\137a24e9f62973f01f16dd23fc1b5a9964fd9ef\servlet-api-2.3.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jcl\5.2.1.RELEASE\a9f6e0b98cd3980b25ab6ead1e59ced0d294d67\spring-jcl-5.2.1.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\aopalliance\aopalliance\1.0\235ba8b489512805ac13a8f9ea77a1ca5ebe3e8\aopalliance-1.0.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-logging\2.2.1.RELEASE\8ba18bb64e02782065526e05bdd1ea5622b04b21\spring-boot-starter-logging-2.2.1.RELEASE.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\jakarta.annotation\jakarta.annotation-api\1.3.5\59eb84ee0d616332ff44aba065f3888cf002cd2d\jakarta.annotation-api-1.3.5.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jdk8\2.10.0\ac9b5e4ec02f243c580113c0c58564d90432afaa\jackson-datatype-jdk8-2.10.0.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jsr310\2.10.0\946bcb4b3ba9facfb338b1d48c2606225205a70c\jackson-datatype-jsr310-2.10.0.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.module\jackson-module-parameter-names\2.10.0\d7ae5421ab27486429aeb878b7e3937544d9324a\jackson-module-parameter-names-2.10.0.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.10.0\1127c9cf62f2bb3121a3a2a0a1351d251a602117\jackson-databind-2.10.0.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.25\8b6e01ef661d8378ae6dd7b511a7f2a33fae1421\snakeyaml-1.25.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-websocket\9.0.27\8d2b93a8621a83d9283a46cae09d8f87bea877fa\tomcat-embed-websocket-9.0.27.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-core\9.0.27\f1bb28625eb8e10ba05081ec840f49a2ea520d85\tomcat-embed-core-9.0.27.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-el\9.0.27\9123115b6d11187154d9f462c89c0b0fce171ade\tomcat-embed-el-9.0.27.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\jakarta.validation\jakarta.validation-api\2.0.1\5a864a58587cd76243b8ec55dd7115c9eac25c08\jakarta.validation-api-2.0.1.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.hibernate.validator\hibernate-validator\6.0.18.Final\7fd00bcd87e14b6ba66279282ef15efa30dd2492\hibernate-validator-6.0.18.Final.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.2.3\7c4f3c474fb2c041d8028740440937705ebb473a\logback-classic-1.2.3.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-to-slf4j\2.12.1\dfb42ea8ce1a399bcf7218efe8115a0b7ab3788a\log4j-to-slf4j-2.12.1.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.slf4j\jul-to-slf4j\1.7.29\f58dd9d8c15a1141a48de53d2d6b723ae6cf18d6\jul-to-slf4j-1.7.29.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.10.0\e01cfd93b80d6773b3f757c78e756c9755b47b81\jackson-annotations-2.10.0.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.10.0\4e2c5fa04648ec9772c63e2101c53af6504e624e\jackson-core-2.10.0.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.jboss.logging\jboss-logging\3.4.1.Final\40fd4d696c55793e996d1ff3c475833f836c2498\jboss-logging-3.4.1.Final.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\com.fasterxml\classmate\1.5.1\3fe0bed568c62df5e89f4f174c101eab25345b6c\classmate-1.5.1.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.2.3\864344400c3d4d92dfeb0a305dc87d953677c03c\logback-core-1.2.3.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.29\e56bf4473a4c6b71c7dd397a833dce86d1993d9d\slf4j-api-1.7.29.jar;C:\Users\renceabishek\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.12.1\a55e6d987f50a515c9260b0451b4fa217dc539cb\log4j-api-2.12.1.jar" com.book.bookShop.BookShopApplication
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.1.RELEASE)
2019-11-14 06:57:40.178 INFO 2036 --- [ main] com.book.bookShop.BookShopApplication : Starting BookShopApplication on renceabishek-PC with PID 2036 (F:\bookShop\bookShop\out\production\classes started by renceabishek in F:\bookShop\bookShop)
2019-11-14 06:57:40.183 INFO 2036 --- [ main] com.book.bookShop.BookShopApplication : No active profile set, falling back to default profiles: default
2019-11-14 06:57:44.825 INFO 2036 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-11-14 06:57:44.887 INFO 2036 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-11-14 06:57:44.887 INFO 2036 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.27]
2019-11-14 06:57:45.293 ERROR 2036 --- [ main] org.apache.catalina.core.ContainerBase : A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [NonLoginAuthenticator[StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122) [na:1.8.0_221]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) [na:1.8.0_221]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) [tomcat-embed-core-9.0.27.jar:9.0.27]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_221]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-embed-core-9.0.27.jar:9.0.27]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [na:1.8.0_221]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:459) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:107) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:88) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:438) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:191) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) [spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at com.book.bookShop.BookShopApplication.main(BookShopApplication.java:10) [classes/:na]
Caused by: org.apache.catalina.LifecycleException: Failed to start component [NonLoginAuthenticator[StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.StandardPipeline.startInternal(StandardPipeline.java:176) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5063) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) [tomcat-embed-core-9.0.27.jar:9.0.27]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_221]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-embed-core-9.0.27.jar:9.0.27]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [na:1.8.0_221]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) [tomcat-embed-core-9.0.27.jar:9.0.27]
... 29 common frames omitted
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;
at org.apache.catalina.authenticator.AuthenticatorBase.startInternal(AuthenticatorBase.java:1220) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.27.jar:9.0.27]
... 39 common frames omitted
2019-11-14 06:57:45.293 ERROR 2036 --- [ main] org.apache.catalina.core.ContainerBase : A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:1.8.0_221]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[na:1.8.0_221]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:459) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:107) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:88) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:438) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:191) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) [spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at com.book.bookShop.BookShopApplication.main(BookShopApplication.java:10) [classes/:na]
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:928) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_221]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) ~[na:1.8.0_221]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
... 21 common frames omitted
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [NonLoginAuthenticator[StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:1.8.0_221]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[na:1.8.0_221]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
... 29 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start component [NonLoginAuthenticator[StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.StandardPipeline.startInternal(StandardPipeline.java:176) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5063) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_221]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) ~[na:1.8.0_221]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
... 29 common frames omitted
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;
at org.apache.catalina.authenticator.AuthenticatorBase.startInternal(AuthenticatorBase.java:1220) ~[tomcat-embed-core-9.0.27.jar:9.0.27]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.27.jar:9.0.27]
... 39 common frames omitted
2019-11-14 06:57:45.308 INFO 2036 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2019-11-14 06:57:45.371 WARN 2036 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2019-11-14 06:57:45.386 INFO 2036 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-11-14 06:57:45.386 ERROR 2036 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.apache.catalina.authenticator.AuthenticatorBase.startInternal(AuthenticatorBase.java:1220)
The following method did not exist:
javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;
The method's class, javax.servlet.ServletContext, is available from the following locations:
jar:file:/C:/Users/renceabishek/.gradle/caches/modules-2/files-2.1/javax.servlet/servlet-api/2.3/137a24e9f62973f01f16dd23fc1b5a9964fd9ef/servlet-api-2.3.jar!/javax/servlet/ServletContext.class
jar:file:/C:/Users/renceabishek/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-core/9.0.27/f1bb28625eb8e10ba05081ec840f49a2ea520d85/tomcat-embed-core-9.0.27.jar!/javax/servlet/ServletContext.class
It was loaded from the following location:
file:/C:/Users/renceabishek/.gradle/caches/modules-2/files-2.1/javax.servlet/servlet-api/2.3/137a24e9f62973f01f16dd23fc1b5a9964fd9ef/servlet-api-2.3.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of javax.servlet.ServletContext
Process finished with exit code 1
Build.Gradle
plugins {
id 'org.springframework.boot' version '2.2.1.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
}
group = 'com.book'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
runtimeOnly 'mysql:mysql-connector-java'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
compile group: 'org.springframework', name: 'spring-jdbc', version: '2.0.6'
compile group: 'org.springframework', name: 'spring-tx', version: '5.2.0.RELEASE'
}
test {
useJUnitPlatform()
}
I can able to understand the issue that server expects upgraded version of servlet, but i haven't specified any servlet dependency in my gradle dependency. How to resolve this?
the method javax.servlet.ServletContext.getVirtualServerName()
was added in servlet version 3.1
. So, from your stacktrace we can deduce that for some reason gradle is resolving an older version for this jar in your case.
It might be because your servlet version is older than 3.1 or some other jar has the servlet with a version older than 3.1 or your tomcat version is older than 8. So , try upgrading all your dependencies to the latest possible version. Like 'spring-jdbc'
in your project is in version '2.0.6'. Try upgrading that to latest version as well.
Steps to take :
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
, so that the servlet version used in your application will be same as that provided by tomcat . When you set the gradle providedCompiler goal it will compile the code with the version of the jar provided but will not include it in the the war/jar so in the end when it is deployed tomcat provided servlet will be used.But ensure that your tomcat is updated and using the same version of servlet that you specify here.The best approach that I can think of is to update all relevant dependencies to latest version so that gradle by default will resolve the latest servlet version while compiling.
It is not clear if a transitive dependency is resulting into availability of version 2.1 of Servlet implementation from location
jar:file:/C:/Users/renceabishek/.gradle/caches/modules-2/files-2.1/javax.servlet/servlet-api/2.3/137a24e9f62973f01f16dd23fc1b5a9964fd9ef/servlet-api-2.3.jar!/javax/servlet/ServletContext.class
However since you are using Tomcat 9.X it needs Servlet version 4.0 or higher.
You can try to delete the version available at jar:file:/C:/Users/renceabishek/.gradle/caches/modules-2/files-2.1/javax.servlet/servlet-api/2.3 ... and run. If Gradle brings it back then it must be transitive dependency from one of the other jars. In such case exclude it just like you have excluded one of the testImplementation jars.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With