Spring Boot项目发布到tomcat7遇到的问题

Spring Boot项目改为war包发布:

     1. 设置为war包发布

            com.ks.xlwj

    SMS_System
    0.0.1-SNAPSHOT
    !-- jar -->

    war

    2.添加tomcat依赖

                

org.springframework.boot
spring-boot-starter-tomcat

    3.设置war包名称

                


org.springframework.boot
spring-boot-maven-plugin


org.apache.maven.plugins
maven-war-plugin

sms



        

    4.继承SpringBootServletInitializer

        @SpringBootApplication
        @ServletComponentScan
        public class SmsApplication extends SpringBootServletInitializer {
            public static void main(String[] args) {
SpringApplication.run(SmsApplication.class, args);
    }

        }

run as -> Maven install war文件生成在target文件夹下

放在tomcat8.5下可以直接运行,放在tomcat7下报错如下:

七月 04, 2018 10:59:11 上午 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(D:\tomcat\webapps\sms\WEB-INF\lib\tomcat-embed-core-8.5.29.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
七月 04, 2018 10:59:11 上午 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(D:\tomcat\webapps\sms\WEB-INF\lib\tomcat-embed-el-8.5.29.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
七月 04, 2018 10:59:11 上午 org.apache.catalina.core.ContainerBase addChildInternal
严重: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/sms]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1245)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1895)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoSuchMethodError: org.apache.tomcat.util.res.StringManager.getManager(Ljava/lang/Class;)Lorg/apache/tomcat/util/res/StringManager;
at org.apache.tomcat.websocket.WsWebSocketContainer.(WsWebSocketContainer.java:78)
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:5481)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 more


七月 04, 2018 10:59:11 上午 org.apache.catalina.startup.HostConfig deployDirectory
严重: Error deploying web application directory D:\tomcat\webapps\sms
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/sms]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1245)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1895)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

https://www.cnblogs.com/niceboat/p/6212837.html 参考很多资料没成功有时间再试.

你可能感兴趣的:(Spring Boot项目发布到tomcat7遇到的问题)