3. 在eclipse中建立tomcat server
由于采用了上述的第二种方法安装tomcat,Ubuntu 默认把 Tomcat 分到2个目录(/user/share/tomcat7和/var/lib/tomcat7),在eclipse中配置哪个安装路径都不对,Eclipse 无法识别安装的 Tomcat,会报以下错误:
Could not load the Tomcat server configuration at /usr/share/tomcat7/conf. The configuration may be corrupt or incomplete. /usr/share/tomcat7/conf/catalina.policy (No such file or directory)
解决方案:(注意下面路径有些有空格)
sudo ln -s /var/lib/tomcat7/conf /usr/share/tomcat7/conf
sudo ln -s /etc/tomcat7/policy.d/03catalina.policy /usr/share/tomcat7/conf/catalina.policy
sudo ln -s /var/log/tomcat7 /usr/share/tomcat7/log
sudo chmod -R 777 /usr/share/tomcat7/conf
重启eclipse后,新建server时,在Tomcat installation directory中选 /usr/share/tomcat7 就可以了。