linux配置java+tomcat
时间:2009-03-09 来源:zbhdpx
CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME$/jre/lib
TOMCAT_HOME=/usr/local/tomcat
export JAVA_HOME CLASSPATH TOMCAT_HOME 五,启动tomcat
[root@localhost usr]# cd /usr/local/tomcat/bin/是目录h
[root@localhost usr]# /usr/local/tomcat/bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/jdk1.5.0 如果看到以上提示,那么说明变量设置没有问题。否则检查配置
6,如果以上配置没有错误,现在可以打开tomcat页面了,看到了熟悉的tomcat。 http://ip:8080 ,默认,tomcat服务在8080端口,下边登陆管理页面, 这个时候,你会发现没有账号和密码,正确的做法是修改/usr/local/tomcat/conf/下的, tomcat-users.xml文件。
tomcat-users.xml 文件内容如下:
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
</tomcat-users>
问题修改:将tomcat-users.xml 文件内容改为
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="admin" password="admin" roles="admin,manager"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
</tomcat-users>
第一次,改错了,出现:
HTTP Status 403 - Access to the requested resource has been denied
,后来按上边的办法修改过来,可以正常登陆了。