1.JAVA_HOME 系统环境变量配置错误,或者没有配置
2.JAVA_HOME 配置好了,但是进入cmd命令行窗口,cd进入到Tomcat的bin文件夹,在bin下输入startup.bat,运行tomcat,报如下错误:
The JRE_HOME environment variable is not defined correctly
This environment variable is needed to run this program
解决办法
用记事本打开tomcat/bin/setclasspath.bat ,在文件首部添加两行代码,jdk和jre的根目录,相当于直接给出JAVA_HOME和JRE_HOME路径
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_101
set JRE_HOME=C:\Program Files\Java\jdk1.8.0_101\jre
3.如果你的机器已经占有了8080 端口,则无法启动,
解决方法
(1) 你可以8080 先关闭
Netstat –an
netstat –anb 来查看谁占用该8080
(2) 主动改变tomcat的端口.
到 conf/server.xml 文件中修改
<Connector connectionTimeout="20000" port="8088" (去修改config->server.xml的端口号)protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="8443"/>
4.能够正常启动,但是会导航到另外一个页面.
去修改工具->管理加载项,把默认的导航给禁用即可.
5.进入manager界面,显示的是403 Access Denied。
解决办法:
在conf/tomcat-users.xml文件中看到这么一段话:
NOTE: By default, no user is included in the "manager-gui" role required to operate the "/manager/html" web application. If you wish to use this app, you must define such a user - the username and password are arbitrary.
也就是说,为了考虑安全,tomcat默认还是没有manager-gui的管理权限的,如果想要使用manager的话,需要自行加入管理权限(角色)。需要加一个这样的权限(角色)
<role rolename="manager-gui"/>
然后再加到需要的用户名中去
<user username="tomcat" password="tomcat" roles="tomcat,manager-gui"/>
这样OK了。
如创建的用户是huan,
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="huan" password="111111" roles="manager-gui,admin-gui"/>