Jul 27, 2019 9:24:30 AM org.apache.catalina.startup.HostConfig deployWARINFO: Deploying web application archive /opt/tomcat_api/webapps/uniapi.warJul 27, 2019 9:24:30 AM org.apache.catalina.loader.WebappClassLoaderBase validateJarFileINFO: validateJarFile(/opt/tomcat_api/webapps/uniapi/WEB-INF/lib/tomcat-embed-core-9.0.16.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.classJul 27, 2019 9:24:30 AM org.apache.catalina.loader.WebappClassLoaderBase validateJarFileINFO: validateJarFile(/opt/tomcat_api/webapps/uniapi/WEB-INF/lib/tomcat-embed-el-9.0.16.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.classJul 27, 2019 9:24:30 AM org.apache.catalina.deploy.WebXml setVersionWARNING: Unknown version string [4.0]. Default version will be used.Jul 27, 2019 9:24:31 AM org.apache.catalina.startup.TldConfig executeINFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.Jul 27, 2019 9:24:31 AM org.apache.catalina.core.ContainerBase addChildInternalSEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/uniapi]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1015) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:991) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2020) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)Caused by: java.lang.NoClassDefFoundError: javax/servlet/GenericFilter at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3205) at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1373) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1861) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735) at org.apache.tomcat.websocket.server.WsServerContainer.(WsServerContainer.java:109) at org.apache.tomcat.websocket.server.WsSci.init(WsSci.java:131) at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:47) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5622) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) ... 10 moreCaused by: java.lang.ClassNotFoundException: javax.servlet.GenericFilter at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735) ... 22 more
在测试环境部署服务,启动Tomcat时提示以上错误。网上搜索,发现是springboot框架自带的tomcat包与实际运行的tomcat有冲突导致的。在pom文件中修改如下:
org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat org.springframework.boot spring-boot-starter-tomcat provided
重新打包、部署即可。