Привет, парни!
Я скачал с сайта apache apache-tomcat-5.5.12, настроил его на Win машине. Теперь нужно проделать тоже самое на Linux. Я распаковал архив, собрал jsvc, добавил в папук с tomcat5 распакованные *.jar из apache-tomcat-5.5.12-compat.zip для совместимости с jre1.4. Потом изменил пример для запуска tomcat и запустил его.
# cd /usr/local/tomcat/5.5/bin/jsvc-src/native
# cp Tomcat5.sh ../..
# vim /usr/local/tomcat/5.5/bin/Tomcat5.sh
# cat /usr/local/tomcat/5.5/bin/Tomcat5.sh
#!/bin/sh
#
# tomcat Start/Stop the Jakarta Tomcat
#
# chkconfig: 345 81 14
# description: Tomcat is the servlet container that is used \
# in the official Reference Implementation for the Java Servlet \
# and JavaServer Pages technologies. The Java Servlet and JavaServer Pages \
# specifications are developed by Sun under the Java Community Process.
#
# processname: jsvc
# pidfile: /var/run/jsvc.pid
# config: /usr/local/tomcat/5.5/conf/server.xml
#
##############################################################################
#
# Copyright 2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##############################################################################
#
# Small shell script to show how to start/stop Tomcat using jsvc
# If you want to have Tomcat running on port 80 please modify the server.xml
# file:
#
# <!-- Define a non-SSL HTTP/1.1 Connector on port 80 -->
# <Connector className="org.apache.catalina.connector.http.HttpConnector"
# port="80" minProcessors="5" maxProcessors="75"
# enableLookups="true" redirectPort="8443"
# acceptCount="10" debug="0" connectionTimeout="60000"/>
#
# That is for Tomcat-5.0.x (Apache Tomcat/5.0)
#
# Adapt the following lines to your configuration
JAVA_HOME=/usr/java/jdk1.5.0_02
CATALINA_HOME=/usr/local/tomcat/5.5
DAEMON_HOME=/usr/local/tomcat/5.5/bin
TOMCAT_USER=tomcat5
TMP_DIR=/var/tmp
CATALINA_OPTS=
CLASSPATH=\
$JAVA_HOME/lib/tools.jar:\
$CATALINA_HOME/bin/commons-daemon.jar:\
$CATALINA_HOME/bin/bootstrap.jar
case "$1" in
start)
#
# Start Tomcat
#
echo -n "Tomcat starting ... "
chown -R tomcat5:tomcat5 /usr/local/tomcat/5.5/*
$DAEMON_HOME/jsvc \
-user $TOMCAT_USER \
-home $JAVA_HOME \
-Dcatalina.home=$CATALINA_HOME \
-Djava.io.tmpdir=$TMP_DIR \
-outfile $CATALINA_HOME/logs/catalina.out \
-errfile '&1' \
$CATALINA_OPTS \
-cp $CLASSPATH \
org.apache.catalina.startup.Bootstrap
#
# To get a verbose JVM
#-verbose \
# To get a debug of jsvc.
#-debug \
;;
stop)
#
# Stop Tomcat
#
echo -n "Tomcat shutting ... "
PID=`cat /var/run/jsvc.pid`
kill $PID
;;
status)
echo "Tomcat processes: "
ps aux --cols 1024 | grep org.apache.catalina.startup.Bootstrap | grep -v grep
;;
restart|reload)
$0 stop
$0 start
exit 0
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload}"
exit 1
;;
esac
echo " [ DONE ]"
exit 0
Он заработал, процесс появился, если смотреть ps aux | grep ...
Запускал еще ./catalina.sh и /.startup.sh
У меня к тому серверу только соединение через ssh клиента. Пользователя нового не делал, ввел вместо TOMCAT_USER=tomcat5 имя пользователя.
У меня имя пользователя 12 символов, высвечивается по ps aux только 7 первых букв от этого имени.
Подскажите где искать ошибку? Почему не могу потом написать http://<имя_хоста>:8080/, чтобы tomcat заработал? Может проблема в имени пользователя. Я пробовал добавить нового, но мне вроде это запрещено. Никаких ошибок скрипты для запуска не писали.
Моя задача всего лишь запустить tomcat демона, дальше разберусь.
Заранее благодарю!
Запуск tomcat5 (Не получается обратиться по http)
Модератор: Модераторы разделов
-
Loky
- Сообщения: 1651
- Статус: Инженер-системотехник
- ОС: Netware, OES, SLED
Re: Запуск tomcat5
Поставь томкат по человечески, как в документации описано.
MOSQIT: Novell/Axigen/Syncsort/Moonwalk/CAStor
-
_YT_
- Сообщения: 239
- ОС: Gentoo Linux ~amd64
Re: Запуск tomcat5
Попробую сделать все в точности как на tomcat.apache.org
-
_YT_
- Сообщения: 239
- ОС: Gentoo Linux ~amd64
Re: Запуск tomcat5
Сделал как написано в официальной документации:
Tomcat can be run as a daemon using the jsvc tool from the commons-daemon project. Source tarballs for jsvc are included with the Tomcat binaries, and need to be compiled. Building jsvc requires a C ANSI compiler (such as GCC), GNU Autoconf, and a JDK.
Before running the script, the JAVA_HOME environment variable should be set to the base path of the JDK. Alternately, when calling the ./configure script, the path of the JDK may be specified using the --with-java parameter, such as ./configure --with-java=/usr/java.
Using the following commands should result in a compiled jsvc binary, located in the $CATALINA_HOME/bin folder. This assumes that GNU TAR is used, and that CATALINA_HOME is an environment variable pointing to the base path of the Tomcat installation.
Please note that you should use the GNU make (gmake) instead of the native BSD make on FreeBSD systems.
cd $CATALINA_HOME/bin
tar xvfz jsvc.tar.gz
cd jsvc-src
autoconf
./configure
make
cp jsvc ..
cd ..
Tomcat can then be run as a daemon using the following commands.
cd $CATALINA_HOME
./bin/jsvc -Djava.endorsed.dirs=./common/endorsed -cp ./bin/bootstrap.jar \
-outfile ./logs/catalina.out -errfile ./logs/catalina.err \
org.apache.catalina.startup.Bootstrap
jsvc has other useful parameters, such as -user which causes it to switch to another user after the daemon initialization is complete. This allows, for example, running Tomcat as a non privileged user while still being able to use privileged ports. jsvc --help will return the full jsvc usage information. In particular, the -debug option is useful to debug issues running jsvc.
The file $CATALINA_HOME/bin/jsvc/native/tomcat.sh can be used as a template for starting Tomcat automatically at boot time from /etc/init.d. The file is currently setup for running Tomcat 4.1.x, so it is necessary to edit it and change the classname from BootstrapService to Bootstrap.
Note that the Commons-Daemon JAR file must be on your runtime classpath to run Tomcat in this manner. The Commons-Daemon JAR file is in the Class-Path entry of the bootstrap.jar manifest, but if you get a ClassNotFoundException or a NoClassDefFoundError for a Commons-Daemon class, add the Commons-Daemon JAR to the -cp argument when launching jsvc.
Все равно не могу к тому серверу обратиться http://<host_name>:8080/
Есть еще варианты почему это так?
Tomcat can be run as a daemon using the jsvc tool from the commons-daemon project. Source tarballs for jsvc are included with the Tomcat binaries, and need to be compiled. Building jsvc requires a C ANSI compiler (such as GCC), GNU Autoconf, and a JDK.
Before running the script, the JAVA_HOME environment variable should be set to the base path of the JDK. Alternately, when calling the ./configure script, the path of the JDK may be specified using the --with-java parameter, such as ./configure --with-java=/usr/java.
Using the following commands should result in a compiled jsvc binary, located in the $CATALINA_HOME/bin folder. This assumes that GNU TAR is used, and that CATALINA_HOME is an environment variable pointing to the base path of the Tomcat installation.
Please note that you should use the GNU make (gmake) instead of the native BSD make on FreeBSD systems.
cd $CATALINA_HOME/bin
tar xvfz jsvc.tar.gz
cd jsvc-src
autoconf
./configure
make
cp jsvc ..
cd ..
Tomcat can then be run as a daemon using the following commands.
cd $CATALINA_HOME
./bin/jsvc -Djava.endorsed.dirs=./common/endorsed -cp ./bin/bootstrap.jar \
-outfile ./logs/catalina.out -errfile ./logs/catalina.err \
org.apache.catalina.startup.Bootstrap
jsvc has other useful parameters, such as -user which causes it to switch to another user after the daemon initialization is complete. This allows, for example, running Tomcat as a non privileged user while still being able to use privileged ports. jsvc --help will return the full jsvc usage information. In particular, the -debug option is useful to debug issues running jsvc.
The file $CATALINA_HOME/bin/jsvc/native/tomcat.sh can be used as a template for starting Tomcat automatically at boot time from /etc/init.d. The file is currently setup for running Tomcat 4.1.x, so it is necessary to edit it and change the classname from BootstrapService to Bootstrap.
Note that the Commons-Daemon JAR file must be on your runtime classpath to run Tomcat in this manner. The Commons-Daemon JAR file is in the Class-Path entry of the bootstrap.jar manifest, but if you get a ClassNotFoundException or a NoClassDefFoundError for a Commons-Daemon class, add the Commons-Daemon JAR to the -cp argument when launching jsvc.
Все равно не могу к тому серверу обратиться http://<host_name>:8080/
Есть еще варианты почему это так?