spring – @Controller causing java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest – Stack Overflow

@Controller causing java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest

来源: spring – @Controller causing java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest – Stack Overflow

You are probably missing right dependencies, like:

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <scope>provided</scope>
        <version>3.1.0</version>
    </dependency>           

Please note that your version could be 2.5, 3.0 or 3.1 – it depends on application server you are using. Also when you want to create executable war you should probably not use provided scope (depending on your servlet container).

分享到: 更多 (0)