SpringServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer

后端 未结 6 1437
广开言路
广开言路 2020-12-03 11:09

I am attempting to move a xml-based Spring MVC app to a Java Configuration based app. There appears to be a mismatch with the various java.servlet classes available in mave

6条回答
  •  执笔经年
    2020-12-03 11:21

    I was facing the same problem wis gradle tomcat plugin. I updated the tomcat version to 8 and it worked.

    plugins {
        id "com.bmuschko.tomcat" version "2.2.2"
        id "java"
        id "eclipse"
        id "idea"
        id "war"
    }
    
    
    dependencies {
        providedCompile ('javax.servlet:javax.servlet-api:3.1.0')
        providedCompile ('javax.servlet.jsp:jsp-api:2.2')
        compile ('org.springframework:spring-webmvc:4.2.1.RELEASE')
    
        def tomcatVersion = '8.0.27'
        tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
                "org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}",
                "org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}"
    
    }
    

提交回复
热议问题