在 Centos 上运行多个 tomcat 实例

在 Centos 上运行多个 tomcat 实例

在 Centos 6.4 上,我尝试根据本教程运行多个 tomcat 实例: http://www.openlogic.com/wazi/bid/188102/

为了说明问题,我将默认配置复制到新实例,/srv/tomcat/solr并保持相同的默认端口值(并且我停止默认服务 /etc/init.d/tomcat6 以避免端口冲突),如下所示:

sudo su -

yum install tomcat6

name=solr

mkdir -p /srv/tomcat/${name}/logs
mkdir /srv/tomcat/${name}/webapps
mkdir /srv/tomcat/${name}/work
mkdir /srv/tomcat/${name}/temp
cp -R /usr/share/tomcat6/conf/ /srv/tomcat/${name}
#rm /srv/tomcat/${name}/conf/tomcat6.conf  # this line is not in the tutorial, but adding it produces the same result
chown -R tomcat. /srv/tomcat/

ln -s /etc/init.d/tomcat6 /etc/init.d/${name}

cat >/etc/sysconfig/${name} <<EOF
CATALINA_BASE="/srv/tomcat/${name}"
CATALINA_PID="/var/run/${name}.pid"
CONNECTOR_PORT="8080"
TOMCAT_LOG="/srv/tomcat/${name}/logs/catalina.out"
EOF

# I keep the default port values at: /srv/tomcat/solr/conf/server.xml

/etc/init.d/tomcat6 stop   # to avoid port conflicts
/etc/init.d/${name} start  # i start my new instance

[root@localhost ~]# /etc/init.d/${name} start
Starting solr:                                             [  OK  ]

[root@localhost ~]# /etc/init.d/${name} status
PID file exists, but process is not running                [FAILED]

[root@localhost ~]# cat /srv/tomcat/solr/logs/catalina.out 
/usr/sbin/tomcat6: line 30: /srv/tomcat/solr/logs/catalina.out: Permission denied

可能存在什么问题?

答案1

在 /etc/sysconfig/${name} 中,删除以下行

TOMCAT_LOG="/srv/tomcat/${name}/logs/catalina.out"

这是默认路径(无论如何),它导致了你的错误

相关内容