[NaLug] Eclipse + Tomcat + Ubuntu = Agliutoooo

Giorgio Agrelli giorgio_a a inwind.it
Gio 3 Maggio 2007 15:37:00 CEST


Black Aidoru wrote:
> ciao raga
> 
> e' una tragedia
> [...]
> la cosa strana e' che ha cominciato lamentandosi di non trovare i file di
> configurazione (web.xml users.xml server.xml e catalinapolicy) che eclipse
> stesso mi mostrava nel pannello laterale.

le variabili d'ambiente JAVA_PATH e JAVA_HOME sono correttamente 
settate?? la jvm è quella sun o quella blackdown? che versione di tomcat 
è? perché tomcat > 5.0.x non è compatibile con java 1.5 mentre tomcat 
5.5 non è compatibile con java 1.4 e precedenti... e parliamo sempre di 
java sun... dovresti assicurarti che nel path non hai alcun altro java 
se non quello di sun (o blackdown, o ibm), e nel classpath ci sta solo 
la robbbba sun, se si mischiano le cose sun e quelle gnu non va nulla 
(*la legendaria "portabilità" di java*)...

cmq in ${TOMCAT_HOME}/bin/catalina.sh dovresti settare tutte le 
variabili che ti servono a mano visto che i vari script puliscono 
l'ambiente da eventuali variabili che potresti avere impostato...

io ad es ti consiglio di scompattare tutto il java sdk in /opt/java e 
tutto tomcat in /opt/tomcat (o fai link simbolici che è meglio), senza 
usare i pacchetti preconfigurati della distro, ma scaricandoli 
"vanilla", e poi settare in catalina.sh qualcosa tipo:

  CATALINA_HOME=/opt/tomcat
  JAVA_HOME=/opt/java

creare un utente non privilegiato apposito, ad es "tomcat" del gruppo 
"tomcat", fare un chown -R tomcat:tomcat /opt/tomcat
e di avviare il tutto con uno script di init del tipo (si dice per 
redhat, ma è stato pulito da tutti gli include di file confunzioni 
strane ed altre menate redhat, quindi va bene ovunque):

**********
#!/bin/sh
#
# chkconfig: 2345 80 20
# description: The Apache Tomcat JSP server
# processname: tomcat
# config:
#
# To use this script
# run it as root - it will switch to the specified user
# It loses all console output - use the log.
#
# Here is a little (and extremely primitive)
# startup/shutdown script for RedHat systems. It assumes
# that tomcat lives in /opt/tomcat, it's run by user
# 'tomcat' and JDK binaries are in /opt/java/bin. All
# this can be changed in the script itself.
#
# Either amend this script for your requirements
# or just ensure that the following variables are set correctly
# before calling the script

# Tomcat startup/shutdown for RedHat

#define where tomcat is - this is the directory containing directories 
#log, bin, conf etc
TOMCAT_HOME=${TOMCAT_HOME:-"/opt/tomcat"}
JAVA_HOME=${JAVA_HOME:-"/opt/java"}

#make java is on your path
JAVAPTH=${JAVAPTH:-"/opt/java/bin"}

#define the script to use to start tomcat
TOMCAT_STARTUP=${TOMCAT_STARTUP:-"$TOMCAT_HOME/bin/startup.sh"}

#define the script to use to stop tomcat
TOMCAT_SHUTDOWN=${TOMCAT_SHUTDOWN:-"$TOMCAT_HOME/bin/shutdown.sh"}

#define the user under which tomcat will run, or use RUNASIS to run as 
the current user
TOMCAT_USER=${TOMCAT_USER:-"tomcat"}

if [ "$TOMCAT_USER" = "RUNASIS" ]; then
   SUBIT=""
else
   SUBIT="su - $TOMCAT_USER -c "
fi

if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then
   export PATH=$PATH:$JAVAPTH
fi

if [ ! -d "$TOMCAT_HOME" ]; then
   echo TOMCAT_HOME does not exist as a valid directory : $TOMCAT_HOME
   exit 1
fi

CMD_START="cd $TOMCAT_HOME/bin; $TOMCAT_STARTUP"
CMD_STOP="cd $TOMCAT_HOME/bin; $TOMCAT_SHUTDOWN"

case "$1" in
start)
     echo CMD_START = $CMD_START
     if [ -z "$SUBIT" ]; then
         eval $CMD_START >/dev/null 2>&1 &
     else
         $SUBIT "$CMD_START >/dev/null 2>&1 &"
     fi
     ;;
stop)
     echo CMD_STOP = $CMD_STOP
     if [ -z "$SUBIT" ]; then
         eval $CMD_STOP  >/dev/null 2>&1 &
     else
         $SUBIT "$CMD_STOP >/dev/null 2>&1 &"
     fi
     ;;
restart)
     $0 stop
     $0 start
     ;;
*)
     echo "usage: $0 (start|stop|restart|help)"
esac
**********

Le variabili reimpostale anche in questo script, una volta in più è 
meglio che una  volta in meno... inoltre ricorda di ridare la proprietà 
all'utente tomcat se crei un file come root o se ci piazzi un war/ear da 
deployare, altrimenti non riesce a fare il deploy/undeploy... inoltre 
ricorda che se gira come utente non privilegiato non può usare port 
inferiori a 1024...

Spero che in tutta sta logorroica mail ci trovi qualcosa di buono ;-)

buon divertimento, e mi raccomando, Javista a me non lo dici...

saluti,

NullPointer quello buono (TM) del C{,++} non quello cattivo di Iava.

-- 
NullPointer  ||  GnuPG/PGP Key-Id: 0x343B22E6
http://cruxppc.sunsite.dk


Maggiori informazioni sulla lista ml