Mac安装Eclipse和Tomcat

Tomcat下载

apache-tomcat-8.0.36.zip

将下载好的安装包解压缩到某个目录。

Eclipse下载

Eclipse IDE for Java EE Developers

Eclipse安装Tomcat插件

Help - Eclipse Marketplace ,搜索 Eclipse Tomcat Plugin,点击Install。

Eclipse中Tomcat配置

  1. 偏好设置 - Tomcat
  2. 偏好设置 - Server - Runtime Environments - Add

错误及解决方法

错误1:The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path

解决方法:右键单击报错的文件夹,选择Build Path - Configue Build Path - Libraies - Add Library - Server Runtime - Apache Tomcat

错误2:You are not authorized to view this page

解决方法:tomcat-users.xml中添加以下内容

1
2
3
4
5
6
7
8
9
10
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status"/>
八宝粥 wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!