Il y a 389 articles et 19 utilisateurs inscrits (ce bandeau est défini dans MediaWiki:Sitenotice)

« Tomcat » : différence entre les versions

De AJLSM
Aller à la navigation Aller à la recherche
 
(18 versions intermédiaires par un autre utilisateur non affichées)
Ligne 2 : Ligne 2 :


[[category:How To]]
[[category:How To]]
== Allocation Mémoire (RAM) avec {{var|JAVA_OPTS}} ==
On utilise la variable d'environnement {{var|JAVA_OPTS}}<ref>[http://publib.boulder.ibm.com/wasce/V2.0.0/en/javaopts.html The JAVA_OPTS environment variable] @ ibm.com</ref> pour définir l'allocation mémoire du processus Tomcat. On placera généralement cette variable dans {{path|{{Tomcat}}/bin/startup.sh}}. Elle peut cependant avoir été défini dans :
* {{path|{{Tomcat}}/bin/catalina.sh}}
* {{path|{{HOME}}/.bashrc}}
On définira la l'option comme suit :
<syntaxhighlight lang="bash">
JAVA_OPTS="-Dfile.encoding=UTF-8 -Xmx2500m -XX:MaxPermSize=128m -XX:NewSize=300m -Djava.awt.headless=true -server"
</syntaxhighlight>
C'est la valeur {{var|-Xmx2500m}} qui défini l'allocation, ici on alloue 2.5Go. On '''adaptera l'allocation en fonction du serveur et en fonction des besoins''' de publication.
=== Forcer la locale ===
Pour forcer la locale du Tomcat, on va rajouter les options {{cmd|-Duser.language&#61;fr}} et {{cmd|-Duser.region&#61;FR"}} dans la variable {{var|JAVA_OPTS}} du fichier {{path|{{tomcat}}/bin/catalina.sh}}.
<syntaxhighlight lang="bash">
JAVA_OPTS="-Dfile.encoding=UTF-8 -Xmx4000m -XX:MaxPermSize=256m -XX:NewSize=300m -Djava.awt.headless=true -server -Duser.language=fr -Duser.region=FR"
</syntaxhighlight>


== Arrêt et redémarrage automatique ==
== Arrêt et redémarrage automatique ==
Ligne 102 : Ligne 82 :
#@daily flushAndRestart back
#@daily flushAndRestart back
</syntaxhighlight>
</syntaxhighlight>
== A propos de l'encodage ==
=== Encodage des paramètres envoyés avec la méthode {{value|GET}} ===
La configuration de {{tomcat}}<ref>[https://wiki.apache.org/tomcat/FAQ/CharacterEncoding#Q2 Configuration de {{tomcat}}]</ref> peut également jouer un rôle dans ce genre de problème. Voici la configuration recommandée (dans {{path|./conf/server.xml}}) pour les connecteur {{value|HTTP}} et {{value|AJP}} :
<syntaxhighlight lang="xml" highlight="2,7">
<Connector port="8080" protocol="HTTP/1.1"
  URIEncoding="UTF-8"/>
<Connector port="8009" protocol="AJP/1.3"
  URIEncoding="UTF-8"/>
</syntaxhighlight>
{{notice|Pleade travaille toujours avec l'[[encodage]] {{value|UTF-8}}}}
=== Configuration Tomcat ({{value|HTTP}} et {{value|AJP}}) ===
La gestion des [[Tomcat#Encodage des paramètres envoyés avec la méthode GET|paramètres envoyés avec la méthode {{value|GET}}]] doit être configurer dans {{path|./conf/server.xml}}.
=== Requête AJAX et IE ===
{{important|Dans {{value|IE7}}, {{value|IE8}} et {{value|IE9}}, les requêtes AJAX envoyées avec la méthode {{value|GET}} ne sont pas URI-encodées. Il faut donc forcer l'encodage des caractères non-ASCII avec {{cmd|encodeURI}}}}
La meilleure solution reste<ref>[http://stackoverflow.com/questions/1549213/whats-the-correct-encoding-of-http-get-request-strings/1549498#1549498 best not to rely on browsers understanding IRIs]</ref> :
# tavailler avec des caractères encodés en {{value|UTF-8}} ;
# encoder les [https://en.wikipedia.org/wiki/Internationalized_Resource_Identifier IRI] en URI (%-encodé) avec la méthode {{cmd|encodeURI()}}




Ligne 157 : Ligne 108 :


/etc/tomcat7/context.xml:
/etc/tomcat7/context.xml:
<syntaxhighlight lang="xml">
  <Context sessionCookiePath="/">
  <Context sessionCookiePath="/">
   [...]
   [...]
     <Resource name="jdbc/pleade_prod" auth="Container" type="javax.sql.DataSource"
     <Resource name="jdbc/pleade_prod" auth="Container" type="javax.sql.DataSource"
        maxActive="100" maxIdle="30" maxWait="10000"
         url="jdbc:mysql://localhost/pleade_prod?useEncoding=true&amp;characterEncoding=UTF-8"
         url="jdbc:mysql://localhost/pleade_prod?useEncoding=true&amp;characterEncoding=UTF-8"
         driverClassName="com.mysql.jdbc.Driver"
         driverClassName="com.mysql.jdbc.Driver"
         username="sdxapp" password="sdxapp-pwd"/>
         username="sdxapp" password="sdxapp-pwd"
        maxTotal="25" maxIdle="10"
        defaultTransactionIsolation="READ_COMMITTED"
        validationQuery="Select 1"
    />
</syntaxhighlight>


/etc/tomcat7/server.xml:
/etc/tomcat7/server.xml:
Ligne 172 : Ligne 128 :
     <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"  
     <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"  
               maxParameterCount="50000" maxPostSize="10000000" maxThreads="50"  
               maxParameterCount="50000" maxPostSize="10000000" maxThreads="50"  
               packetSize="8192000" maxThreads="150" URIEncoding="UTF-8" />
               packetSize="8192000" URIEncoding="UTF-8" />


/etc/default/tomcat7:
/etc/default/tomcat7:
  JAVA_OPTS="-Djava.awt.headless=true -Xmx2048m -Duser.language=fr -Duser.region=FR -Dfile.encoding=UTF-8 -XX:+UseConcMarkSweepGC"
  JAVA_OPTS="-Djava.awt.headless=true -Xmx2048m -XX:+UseConcMarkSweepGC -Duser.language=fr -Duser.region=FR -Dfile.encoding=UTF-8 -XX:PermSize=128m -XX:MaxPermSize=128m -XX:NewSize=256m -Djava.security.egd=file:/dev/./urandom"


Il faut également ajouter dans la configuration apache pour le serveur :
Il faut également ajouter dans la configuration apache pour le serveur :
Ligne 184 : Ligne 140 :
</syntaxhighlight>
</syntaxhighlight>


=== AVEC APR ===
# Installer libtcnative-1
# Décommenter la ligne dans server.xml
Cf http://vincentdevillers.blogspot.fr/2013/09/installing-tomcat-7-on-debianubuntu.html
Pour CentOS/HEL: http://blogoless.blogspot.fr/2012/08/how-to-install-apache-tomcat-native.html


=== Gestion des sessions ===
== Checklist ==
# '''sessionCookiePath="/"''' dans <Context de ''context.xml''
# '''?useEncoding=true&amp;characterEncoding=UTF-8''' dans la <Resource de ''context.xml''
# '''max*''' & '''URIEncoding="UTF-8"''' dans les <Connector de ''server.xml''
# ''-Xmx2048m -Duser.language=fr -Duser.region=FR -Dfile.encoding=UTF-8'' dans les JAVA_OPTS
# Le paramétrage Apache2, cf ci-dessus


{{important|La gestion des sessions à changer dans Tomcat7<ref>[http://stackoverflow.com/questions/3980392/tomcat-7-session-cookie-path Tomcat 7 session cookie path] @ StackOverflow</ref>}}
= Tomcat 6 =
L'attribut que {{attr|emptySessionPath}}="{{value|true}}" que l'on placer dans les connecteurs du fichier {{path|<tomcat'''6'''>/conf/server.xml}} ne sert plus.
 
Il faut maintenant éditer le fichier {{path|<tomcat'''7'''>/conf/context.xml}} et ajouter l'attribut {{attr|sessionCookiePath}}="{{value|/}}", puis redémarrer le serveur Tomcat.<ref>[https://tomcat.apache.org/migration-7.html#Session_cookie_configuration Session cookie configuration] @ Tomcat doc</ref>
== Exemple de configuration ==
 
/etc/tomcat6/context.xml:
  [...]
    <Resource name="jdbc/pleade_prod" auth="Container" type="javax.sql.DataSource"
        maxActive="100" maxIdle="30" maxWait="10000"
        url="jdbc:mysql://localhost/pleade_prod?useEncoding=true&amp;characterEncoding=UTF-8"
        driverClassName="com.mysql.jdbc.Driver"
        username="sdxapp" password="sdxapp-pwd"/>
 
/etc/tomcat6/server.xml:
    <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"
              maxParameterCount="50000" maxPostSize="10000000" emptySessionPath="true"
              maxHttpHeaderSize="8192000" URIEncoding="UTF-8" />
    [...]
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"
              maxParameterCount="50000" maxPostSize="10000000"
              emptySessionPath="true" packetSize="8192000"
              maxThreads="50" URIEncoding="UTF-8" />
 
/etc/default/tomcat6:
JAVA_OPTS="-Djava.awt.headless=true -Xmx2048m -Duser.language=fr -Duser.region=FR -Dfile.encoding=UTF-8 -XX:+UseConcMarkSweepGC"
 
Il faut également ajouter dans la configuration apache pour le serveur :
<syntaxhighlight lang="bash">
<VirtualHost *:80>
        LimitRequestFieldSize 81920
        ProxyIOBufferSize 81920
</syntaxhighlight>
 
== Checklist ==
# '''?useEncoding=true&amp;characterEncoding=UTF-8''' dans la <Resource de ''context.xml''
# '''max*''' '''emptySessionPath="true"''' & '''URIEncoding="UTF-8"''' dans les <Connector de ''server.xml''
# ''-Xmx2048m -Duser.language=fr -Duser.region=FR -Dfile.encoding=UTF-8'' dans les JAVA_OPTS
# Le paramétrage Apache2, cf ci-dessus


= Tomcat 6 =
== Arrêter Tomcat 6.0 à partir du PID ==
== Arrêter Tomcat 6.0 à partir du PID ==



Dernière version du 21 mai 2016 à 20:59

Notice :
Si vous ne parvenez pas à trouver Tomcat, consulter la page Localiser Tomcat.

Arrêt et redémarrage automatique

[modifier | modifier le wikicode]

Nous utiliserons un script init dans le cas d'une installation à partir des sources de Apache Tomcat.<ref>Writing Startup Script for tomcat 6 </ref>

Remarques : Il est inutile de suivre cette procédure lors d'une installation via le gestionnaire de paquet de votre OS.


Création du script

[modifier | modifier le wikicode]
Important :
Si vous avez plusieurs instance tomcat il faudra un script d'initialisation pour chaque instance.
Notice :
Penser à adapter le chemin vers le dossier de votre Tomcat (cf. $CATALINA_HOME) et le chemin vers la JVM ($JAVA_HOME).

Il faut placer le contenu du script ci-dessous dans /etc/init.d/tomcat-front|back.sh

#!/bin/sh
###BEGIN INIT INFO
# Provides:          tomcat
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Should-Start:      $named
# Should-Stop:       $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start Tomcat.
# Description:       Start the Tomcat servlet engine.
### END INIT INFO
# Tomcat 6 init-script

# ATTENTION ! Si vous avez plusieurs instance tomcat il faudra plusieurs script d'initialisation
CATALINA_HOME=/opt/tomcat6-front
JAVA_HOME=/usr/lib/jvm/java-6-sun
#JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.13

export CATALINA_HOME
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
case $1 in
     start)
          sh "$CATALINA_HOME"/bin/startup.sh
          echo "tomcat6 started successfully"
          ;;
     stop)
          sh "$CATALINA_HOME"/bin/shutdown.sh
          echo "tomcat6 stoped successfully"
          ;;
     restart)
          sh "$CATALINA_HOME"/bin/shutdown.sh
          sh "$CATALINA_HOME"/bin/startup.sh
          echo "tomcat6 restarted successfully"
          ;;
       *)
          sh "$CATALINA_HOME"/bin/startup.sh
          echo "tomcat6 started successfully"
   ;;

     esac
exit 0


Ajout du script init au système

[modifier | modifier le wikicode]

Il faut d'abord rendre le script /etct/init.d/tomcat-front|back.sh executable par le système puis on l'ajoute aux scripts démarrer par défaut :

chmod u=rwx,g=rx,o=x tomcat6*
update-rc.d tomcat6-front.sh defaults

On fait un petit test pour vérfier qu'il n'y a pas d'erreur :

/etc/init.d/tomcat6-front.sh restart


Tâche cron journalière de redémarrage

[modifier | modifier le wikicode]
Important :
La description ci-dessous considère que vous utiliser l'Arborescence de production et les scripts shell préconisé pour les installations..

On s'appuie sur la function flushAndRestart défini dans ~/.bashrc ou ~/.ajlsmrc

@daily  flushAndRestart front
#@daily flushAndRestart back


Installation:

apt-get install tomcat7 imagemagick 

Post-installation

mkdir /usr/share/tomcat7/.fop
chown tomcat7:tomcat7 /usr/share/tomcat7/.fop

Tests:

convert
Publication
Recherche accentuée
Export PDF

Exemple de configuration

[modifier | modifier le wikicode]

Vider les welcome-file-list, afin que Tomcat 7 ne rajoute pas "index.html" à la fin de chaque url terminant par "/".

/etc/tomcat7/web.xml:4280

   <welcome-file-list>
   </welcome-file-list>


/etc/tomcat7/context.xml:

 <Context sessionCookiePath="/">
  [...]
    <Resource name="jdbc/pleade_prod" auth="Container" type="javax.sql.DataSource"
        url="jdbc:mysql://localhost/pleade_prod?useEncoding=true&amp;characterEncoding=UTF-8"
        driverClassName="com.mysql.jdbc.Driver"
        username="sdxapp" password="sdxapp-pwd"
        maxTotal="25" maxIdle="10"
        defaultTransactionIsolation="READ_COMMITTED"
        validationQuery="Select 1"
    />

/etc/tomcat7/server.xml:

   <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"
              maxParameterCount="50000" maxPostSize="10000000"
              maxHttpHeaderSize="8192000" URIEncoding="UTF-8" />
   [...]
   <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" 
              maxParameterCount="50000" maxPostSize="10000000" maxThreads="50" 
              packetSize="8192000" URIEncoding="UTF-8" />

/etc/default/tomcat7:

JAVA_OPTS="-Djava.awt.headless=true -Xmx2048m -XX:+UseConcMarkSweepGC -Duser.language=fr -Duser.region=FR -Dfile.encoding=UTF-8 -XX:PermSize=128m -XX:MaxPermSize=128m -XX:NewSize=256m -Djava.security.egd=file:/dev/./urandom"

Il faut également ajouter dans la configuration apache pour le serveur :

<VirtualHost *:80>
        LimitRequestFieldSize 81920
        ProxyIOBufferSize 81920
  1. Installer libtcnative-1
  2. Décommenter la ligne dans server.xml

Cf http://vincentdevillers.blogspot.fr/2013/09/installing-tomcat-7-on-debianubuntu.html Pour CentOS/HEL: http://blogoless.blogspot.fr/2012/08/how-to-install-apache-tomcat-native.html

  1. sessionCookiePath="/" dans <Context de context.xml
  2. ?useEncoding=true&characterEncoding=UTF-8 dans la <Resource de context.xml
  3. max* & URIEncoding="UTF-8" dans les <Connector de server.xml
  4. -Xmx2048m -Duser.language=fr -Duser.region=FR -Dfile.encoding=UTF-8 dans les JAVA_OPTS
  5. Le paramétrage Apache2, cf ci-dessus

Exemple de configuration

[modifier | modifier le wikicode]

/etc/tomcat6/context.xml:

 [...]
   <Resource name="jdbc/pleade_prod" auth="Container" type="javax.sql.DataSource"
       maxActive="100" maxIdle="30" maxWait="10000"
       url="jdbc:mysql://localhost/pleade_prod?useEncoding=true&characterEncoding=UTF-8"
       driverClassName="com.mysql.jdbc.Driver"
       username="sdxapp" password="sdxapp-pwd"/>

/etc/tomcat6/server.xml:

   <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"
              maxParameterCount="50000" maxPostSize="10000000" emptySessionPath="true"
              maxHttpHeaderSize="8192000" URIEncoding="UTF-8" />
   [...]
   <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" 
              maxParameterCount="50000" maxPostSize="10000000" 
              emptySessionPath="true" packetSize="8192000" 
              maxThreads="50" URIEncoding="UTF-8" />

/etc/default/tomcat6:

JAVA_OPTS="-Djava.awt.headless=true -Xmx2048m -Duser.language=fr -Duser.region=FR -Dfile.encoding=UTF-8 -XX:+UseConcMarkSweepGC"

Il faut également ajouter dans la configuration apache pour le serveur :

<VirtualHost *:80>
        LimitRequestFieldSize 81920
        ProxyIOBufferSize 81920
  1. ?useEncoding=true&characterEncoding=UTF-8 dans la <Resource de context.xml
  2. max* emptySessionPath="true" & URIEncoding="UTF-8" dans les <Connector de server.xml
  3. -Xmx2048m -Duser.language=fr -Duser.region=FR -Dfile.encoding=UTF-8 dans les JAVA_OPTS
  4. Le paramétrage Apache2, cf ci-dessus

Arrêter Tomcat 6.0 à partir du PID

[modifier | modifier le wikicode]

Arrêter Tomcat :

$TOMCAT_HOME/bin/catalina.sh stop

Définir la variable d'environnement CATALINA_BASE dans ~/.profile :

CATALINA_BASE=/usr/local/apache-tomcat-6.0.36

Créer le fichier $TOMCAT_HOME/bin/setenv.sh :

CATALINA_PID="$CATALINA_BASE/bin/catalina.pid"

Redémarrer Tomcat :

$TOMCAT_HOME/bin/catalina.sh start

Pour arrêter Tomcat :

cat $TOMCAT_HOME/bin/catalina.pid | xargs kill -9

Erreurs à l'arrêt du serveur

[modifier | modifier le wikicode]
$ catalina.sh stop
Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.36
Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.36
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.36/temp
Using JRE_HOME:        /usr/local/jdk1.6.0_39
Using CLASSPATH:       /usr/local/apache-tomcat-6.0.36/bin/bootstrap.jar
Using CATALINA_PID:    /usr/local/apache-tomcat-6.0.36/bin/catalina.pid
15 mars 2013 11:22:47 org.apache.catalina.startup.Catalina stopServer
GRAVE: Catalina.stop: 
java.net.ConnectException: Connection refused
	at java.net.PlainSocketImpl.socketConnect(Native Method)

Arrêter Tomcat :

cat $TOMCAT_HOME/bin/catalina.pid | xargs kill -9

Supprimer le fichier catalina.pid :

rm -f $TOMCAT_HOME/bin/catalina.pid

Démarrer Tomcat :

$TOMCAT_HOME/bin/catalina.sh start


Démarrer Tomcat

[modifier | modifier le wikicode]

On utilise soit le script $TOMCATcatalina.sh, soit le script startup.sh.


netstat -a | grep "LISTEN"
tcp        0      0 localhost.localdom:7634 *:*                     LISTEN     
tcp        0      0 localhost.locald:domain *:*                     LISTEN     
tcp        0      0 *:ssh                   *:*                     LISTEN     
tcp        0      0 localhost.localdoma:ipp *:*                     LISTEN     
tcp        0      0 localhost.lo:postgresql *:*                     LISTEN     
tcp        0      0 localhost.localdom:smtp *:*                     LISTEN     
tcp        0      0 *:http                  *:*                     LISTEN     
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN     
tcp6       0      0 ip6-localhost:ipp       [::]:*                  LISTEN     
tcp6       0      0 ip6-localhost:smtp      [::]:*                  LISTEN     
tcp6       0      0 localhost.localdom:8005 [::]:*                  LISTEN     
tcp6       0      0 [::]:8009               [::]:*                  LISTEN     
tcp6       0      0 [::]:http-alt           [::]:*                  LISTEN


Les logs de tomcat

[modifier | modifier le wikicode]
Important :

Selon les serveurs et les distributions, le serveur Apache Tomcat se trouve dans des répertoires différents. Il faut donc :

  1. localiser Tomcat ;
  2. définir la variable tomcatDir.
On peut ensuite executer les commandes ci-dessous.


La journalisation de Tomcat

[modifier | modifier le wikicode]
tail -f $TOMCAT_HOME/logs/catalina.out

Supprimer les fichiers de journalisation de Tomcat

[modifier | modifier le wikicode]
sudo service tomcat6 stop
sudo rm "$tomcatDir"/logs/*
sudo service tomcat6 start


L'erreur suivante est indiquée dans les logs du fichier catalina.out:

INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/local/jdk1.6.0_45/jre/lib/i386/server:/usr/local/jdk1.6.0_45/jre/lib/i386:/usr/local/jdk1.6.0_45/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib

Pré-requis :

  • les outils nécessaires pour compiler en C/C++;
  • un jdk 6 installé et la variable d'environnement JAVA_HOME configurée;
  • un tomcat 6 installé et la variable d'environnement CATALINA_HOME configurée;
  • éventuellement openssl.
apt-get update
apt-get install openssl gcc make

$JAVA_HOME/bin/java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) Server VM (build 20.45-b01, mixed mode)

echo $CATALINA_HOME
/usr/local/apache-tomcat-6.0.36
apt-get install libapr1-dev libssl-dev
cd $CATALINA_HOME/bin
wget http://apache.websitebeheerjd.nl//tomcat/tomcat-connectors/native/1.1.27/source/tomcat-native-1.1.27-src.tar.gz
cp tomcat-native-1.1.27-src.tar.gz /usr/local/src/libs-tomcat-6.0.36/
tar -xvzf tomcat-native-1.1.27-src.tar.gz
cd tomcat-native-1.1.27-src/jni/native/
./configure --with-apr=/usr/bin/apr-1-config --with-java-home=$JAVA_HOME --with-ssl=yes --prefix=$CATALINA_HOME
make && make install

/usr/bin/apr-1-config est le chemin par défaut du binaire APR. Ce chemin peut changer suivant la version de la librairie APR.

La fin de l'installation doit se terminer par les lignes suivantes :

----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/apache-tomcat-6.0.36/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Et enfin ajouter dans /etc/init.d/tomcat ou par exemple dans ~/.profile, la variable d'environnement LD_LIBRARY_PATH des librairies de Tomcat :

{{path|LD_LIBRARY_PATH=$CATALINA_HOME/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH}}

Dans le cas de l'utilisation du fichier ~/.profile, le shell courant prendra en charge la nouvelle configuration de ce fichier grace à la commande :

source ~/.profile

On vérifie la prise en charge de l'APR par Tomcat :

On redémarre Tomcat :

$CATALINA_HOME/bin/catalina.sh stop
$CATALINA_HOME/bin/catalina.sh start

Le fichier de log $CATALINA_HOME/logs/catalina.out doit contenir les lignes suivantes :

25 avr. 2013 14:43:59 org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.27 using APR version 1.4.2.
25 avr. 2013 14:43:59 org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
25 avr. 2013 14:43:59 org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized with version OpenSSL 0.9.8o 01 Jun 2010

Note : il est aussi possible d'installer la librairie APR manuellement.

cd /usr/local/src
wget http://wwwftp.ciril.fr/pub/apache//apr/apr-1.4.6.tar.gz
tar -xvzf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure --prefix=/usr/local/apache-tomcat-6.0.36/lib/apr
make 
make test
make install


Pour Tomcat 6.0, la documentation de l'APR est sur http://tomcat.apache.org/tomcat-6.0-doc/apr.html#Installation et les sources sont disponibles sur http://apr.apache.org/download.cgi.

Pour plus de détails, voir http://quickfix.free.fr/?p=350.


Localiser Tomcat

[modifier | modifier le wikicode]

Voici la liste des emplacement où j'ai pu rencontrer (ou placer) Apache Tomcat :

  • /opt/
  • ~/apps/tomcat-*
  • ~/apps/apache-tomcat-*
  • /mnt/data/apps/tomcat-*
  • /mnt/data/apps/apache-tomcat-*



  1. FAQ / Memory @ Tomcat wiki

<references/>

Voir la version de tomcat

[modifier | modifier le wikicode]
java -cp /usr/share/tomcat6/lib/catalina.jar org.apache.catalina.util.ServerInfo