程序包javax.servlet.http不存在,“错误:找不到符号”

本文介绍了在使用Eclipse进行Java Web开发时,遇到缺少servlet-api.jar的问题及两种解决方案。一种是从Tomcat的lib目录下导入,另一种是在pom.xml中加入依赖。
1. 原因

eclipse缺少servlet-api.jar 这个jar包

2. 解决方法
2.1 方法一:从tomcat的lib目录下导入servlet-api.jar

项目右键>>Properties>>Jvav Build Path>>Libraries>>Add External JARS…

2.2 方法二:pom.xml中加入一下依赖
<!-- 程序包javax.servlet.http -->
    	<dependency>
    		<groupId>javax.servlet</groupId>
    		<artifactId>servlet-api</artifactId>
    		<version>2.5</version>
    		<scope>provided</scope>
		</dependency>    	
构建 失败 WebMvcConfiguration.java 程序包lombok.extern.slf4j存在 程序包org.springframework.beans.factory.annotation存在 程序包org.springframework.context.annotation存在 程序包org.springframework.context.annotation存在 程序包org.springframework.web.servlet.config.annotation存在 程序包org.springframework.web.servlet.config.annotation存在 程序包org.springframework.web.servlet.config.annotation存在 程序包springfox.documentation.builders存在 程序包springfox.documentation.builders存在 程序包springfox.documentation.builders存在 程序包springfox.documentation.service存在 程序包springfox.documentation.spi存在 程序包springfox.documentation.spring.web.plugins存在 不到符号 不到符号 不到符号 不到符号 不到符号 不到符号 不到符号 不到符号 JwtTokenAdminInterceptor.java 程序包com.sky.constant存在 程序包com.sky.properties存在 程序包com.sky.utils存在 程序包io.jsonwebtoken存在 程序包lombok.extern.slf4j存在 程序包org.springframework.beans.factory.annotation存在 程序包org.springframework.stereotype存在 程序包org.springframework.web.method存在 程序包org.springframework.web.servlet存在 程序包javax.servlet.http存在 程序包javax.servlet.http存在 不到符号 不到符号 不到符号 不到符号 不到符号 不到符号 不到符号 EmployeeController.java 程序包com.sky.constant存在 程序包com.sky.dto存在 程序包com.sky.entity存在 程序包com.sky.properties存在 程序包com.sky.result存在 程序包com.sky.utils存在 程序包com.sky.vo存在 程序包lombok.extern.slf4j存在 程序包org.springframework.beans.factory.annotation存在 程序包org.springframework.web.bind.annotation存在 程序包org.springframework.web.bind.annotation存在 程序包org.springframework.web.bind.annotation存在 程序包org.springframework.web.bind.annotation存在 不到符号 不到符号 不到符号 不到符号 不到符号 不到符号 不到符号 不到符号 不到符号 不到符号 EmployeeService.java 程序包com.sky.dto存在 程序包com.sky.entity存在 不到符号 不到符号 GlobalExceptionHandler.java EmployeeMapper.java EmployeeServiceImpl.java SkyApplication.java
07-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值