Spring Boot java.lang.NoClassDefFoundError: javax/servlet/Filter

前端 未结 8 1023
慢半拍i
慢半拍i 2020-12-08 01:44

I Started a new project with Spring Boot 1.2.3. I\'m getting error

java.lang.NoClassDefFoundError: javax/servlet/Filter

Gradle Dependencie

相关标签:
8条回答
  • 2020-12-08 02:39

    The configuration here is working for me:

    configurations {
        customProvidedRuntime
    }
    
    dependencies {
        compile(
            // Spring Boot dependencies
        )
    
        customProvidedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
    }
    
    war {
        classpath = files(configurations.runtime.minus(configurations.customProvidedRuntime))
    }
    
    springBoot {
        providedConfiguration = "customProvidedRuntime"
    }
    
    0 讨论(0)
  • 2020-12-08 02:42

    for the maven users, comment the scope provided in the following dependency:

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <!--<scope>provided</scope>-->
        </dependency>
    

    UPDATE

    As feed.me mentioned you have to uncomment the provided part depending on what kind of app you are deploying.

    Here is a useful link with the details: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#build-tool-plugins-maven-packaging

    0 讨论(0)
提交回复
热议问题