---
title: "servlet-api.jar、jsp.jar 项目环境与部署容器 冲突的问题"
author: "gatusso52"
date: "2010-04-22T13:22:59Z"
tags: ["Eclipse", "JSP", "Myeclipse", "Servlet", "maven"]
categories: ["企业架构"]
slug: "servlet-api-jar-jsp-jar"
draft: false
lastmod: "2010-04-22T13:27:04Z"
id: 650329
url: "https://gatusso52.iteye.com/blog/650329"
---

工程中依赖这两个jar

所以必须加入classpath

 

但是部署到tomcat下会与common/lib冲突

 

有人说解决办法是手动去删

有人说解决办法是在JAVA\_HOME中加入这两个jar

但更好的办法应该是直接不让它部署

 

在maven中：

```
		<dependency>
			<groupId>javax.servlet.jsp</groupId>
			<artifactId>jsp-api</artifactId>
			<version>2.1</version>
			<scope>provided</scope>
		</dependency>
```

 

 

这个在myelipse中还有问题需要：

Most people should be able to hot-deploy as normal now using the MyEclipse server tools, however i have noticed some people have problems with servlet-api.jar and jsp-api.jar conflicts, if that is the case then the following steps should fix that:

 

Right click on your project and go to the properties&gt;java build path&gt;libraries You will need to look through this list for servlet-api.jar and jsp-api.jar, remove them and add the J2EE library (You will need to do this each time you run the eclipse target or else your servlet-api.jar and jsp-api.jar will get deployed to your web server and may interfere with the one it already has in it’s classpath

 

Next, still under the project properties item go to MyEclpse-&gt;Web-&gt;Deployment uncheck the ‘workbench default settings’ and ‘Jars in web Projects user Libraries’ you should now be able to do a normal MyEclipse hot-deploy…

 

见[http://www.oneadam.net/?p=39](http://www.oneadam.net/?p=39)

 

感谢大牛GL的指导！