IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Apache Discussion :

Problème configuration Apache/Tomcat avec jk.mod


Sujet :

Apache

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    3
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 3
    Par défaut Problème configuration Apache/Tomcat avec jk.mod
    Bonjour,

    Pour un projet, j'ai besoin de mettre en place un serveur Tomcat (première fois que je fais du JSP). J'ai donc un serveur chez OVH pour héberger l'ensemble.

    Il m'a été demandé de préférence de configurer Tomcat en passant par Apache avec jk.mod

    J'ai donc suivi un tutorial assez basique, il est plus très d'actualité mais j'pense avoir bien respecté les étapes de configuration (j'ai plus d'erreurs dans les logs de jk.mod et d'apache).

    Mon serveur Apache est sur le port 80, Tomcat sur le 8080. Mes deux serveurs indépendamment marchent, sur le port 8080 j'arrive bien à exécuter les exemples fournis avec Tomcat en jsp. Cependant, je veux pouvoir réaliser ça en passant par apache.

    J'ai donc modifié le virtualhost basique
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
    
            DocumentRoot /var/www
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    
    
              Alias /tomcat "/usr/local/tomcat/webapps/examples"
    <Directory "/usr/local/tomcat/webapps/examples">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            Order allow,deny
            Allow from all
        </Directory>
    
    
    
            JkMount /tomcat/* ajp13_worker
    
    
     ErrorLog ${APACHE_LOG_DIR}/error.log
     # Possible values include: debug, info, notice, warn, error, crit,
     # alert, emerg.
      LogLevel warn
    
     CustomLog ${APACHE_LOG_DIR}/access.log combined
    
    </VirtualHost>
    J'ai donc rajouté un Alias pointé sur le répertoires d'exemples avec JkMount sur l'alias (Je suis pas sur de ma démarche, j'ai pas trouvé de vrai tuto)

    J'ai donc bien accès à http://monsite.com/tomcat/ qui me renvoie une page d'exemples mais lorsque j'essaye d'accéder à ces exemples

    Je me mange des erreurs 404 pour les différents exemples en JSP
    HTTP Status 404 - /tomcat/servlets/servlet/HelloWorldExample

    type Status report

    message /tomcat/servlets/servlet/HelloWorldExample

    description The requested resource (/tomcat/servlets/servlet/HelloWorldExample) is not available.

    Apache Tomcat/7.0.23
    J'ai du mal à voir pourquoi ça marche sur le port 8080 mais pas sur le 80 alors qu'à priori, apache est censé rediriger les requêtes pour cet alias. J'ai pas d'erreurs dans les différents fichiers de log, donc c'est soit un problème de configuration, soit de mapping dans le fichier web.xml de tomcat :/

    merci d'avance !

  2. #2
    Rédacteur
    Avatar de _Mac_
    Profil pro
    Inscrit en
    Août 2005
    Messages
    9 601
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 9 601
    Par défaut
    Pourquoi tu as configuré un alias pour Tomcat ? Le problème est là : mod_jk fait le truc que tu penses faire avec ton alias. Avec mod_jk, le truc c'est d'écrire un fichier workers.properties : l'as-tu fait et qu'y a-t-il dedans ?

  3. #3
    Futur Membre du Club
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    3
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 3
    Par défaut
    merci déjà !

    En effet j'ai viré la config merdique d'apache2, du coup j'ai l'erreur 404 de tomcat des que je me sert de monsite.com/tomcat/ ce qui me parait plus logique.

    Mon serveur apache redirige bien vers tomcat les requêtes lui étant destinés, donc pour ça, il m'a l'air bien configuré et le workers aussi si j'ai bien compris son rôle.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
     
    # workers.properties -
    #
    # This file is a simplified version of the workers.properties supplied
    # with the upstream sources. The jni inprocess worker (not build in the
    # debian package) section and the ajp12 (deprecated) section are removed.
    #
    # As a general note, the characters $( and ) are used internally to define
    # macros. Do not use them in your own configuration!!!
    #
    # Whenever you see a set of lines such as:
    # x=value
    # y=$(x)\something
    #
    # the final value for y will be value\something
    #
    # Normaly all you will need to do is un-comment and modify the first three
    # properties, i.e. workers.tomcat_home, workers.java_home and ps.
    # Most of the configuration is derived from these.
    #
    # When you are done updating workers.tomcat_home, workers.java_home and ps
    # you should have 3 workers configured:
    #
    # - An ajp13 worker that connects to localhost:8009
    # - A load balancer worker
    #
    #
     
    # OPTIONS ( very important for jni mode )
     
    #
    # workers.tomcat_home should point to the location where you
    # installed tomcat. This is where you have your conf, webapps and lib
    # directories.
    #
    workers.tomcat_home=/usr/share/tomcat6
     
    #
    # workers.java_home should point to your Java installation. Normally
    # you should have a bin and lib directories beneath it.
    #
    workers.java_home=/usr/lib/jvm/default-java
     
    #
    # You should configure your environment slash... ps=\ on NT and / on UNIX
    # and maybe something different elsewhere.
    #
    ps=/
     
    #
    #------ ADVANCED MODE ------------------------------------------------
    #---------------------------------------------------------------------
    #
     
    #
    #------ worker list ------------------------------------------
    #---------------------------------------------------------------------
    #
     
     
     
    # The workers that your plugins should create and work with
    #
    worker.list=ajp13_worker
     
    #
    #------ ajp13_worker WORKER DEFINITION ------------------------------
    #---------------------------------------------------------------------
    #
     
    #
    # Defining a worker named ajp13_worker and of type ajp13
    # Note that the name and the type do not have to match.
    #
    worker.ajp13_worker.port=8009
    worker.ajp13_worker.host=localhost
    worker.ajp13_worker.type=ajp13
    #
    # Specifies the load balance factor when used with
    # a load balancing worker.
    # Note:
    #  ----> lbfactor must be > 0
    #  ----> Low lbfactor means less work done by the worker.
    worker.ajp13_worker.lbfactor=1
     
    #
    # Specify the size of the open connection cache.
    #worker.ajp13_worker.cachesize
     
    #
    #------ DEFAULT LOAD BALANCER WORKER DEFINITION ----------------------
    #---------------------------------------------------------------------
    #
     
    #
    # The loadbalancer (type lb) workers perform wighted round-robin
    # load balancing with sticky sessions.
    # Note:
    #  ----> If a worker dies, the load balancer will check its state
    #        once in a while. Until then all work is redirected to peer
    #        workers.
    worker.loadbalancer.type=lb
    worker.loadbalancer.balance_workers=ajp13_worker
    Par contre, y'a quelque chose que je comprend pas, c'est à quel niveau qu'on sélectionne à quel webapp correspond "http://.../tomcat" dans tomcat?

    J'ai cru comprendre que ce "mapping" se faisait au niveau tomcat/conf/web.xml pour rediriger les urls sur les bonnes applis, puis pour chaque application, il y'avait un propre fichier de config dans WEB-INF mais j'ai l'impression de m'être planté royalement :/

  4. #4
    Rédacteur
    Avatar de _Mac_
    Profil pro
    Inscrit en
    Août 2005
    Messages
    9 601
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 9 601
    Par défaut
    Je ne connais pas bien Tomcat mais je dirais que /tomcat comme tu dis doit correspondre à un fichier tomcat.war déployé dans le répertoire webapps (après, tu dois pouvoir changer le /tomcat dans l'interface d'administration de Tomcat). En gros, le principe de Tomcat c'est que le context root (le /tomcat) correspond au nom du .war donc si tu as un fichier toto.war copié dans webapps, le context root pour ce WAR est /toto donc tu dois mettre /toto dans ton JkMount dans Apache.

Discussions similaires

  1. Problème configuration Eclipse JEE avec Tomcat
    Par Tora21 dans le forum Eclipse Java
    Réponses: 1
    Dernier message: 22/06/2011, 08h50
  2. Problème de configuration Apache <<-->> Tomcat
    Par welcometohell38 dans le forum Apache
    Réponses: 6
    Dernier message: 27/04/2010, 15h27
  3. Problème configuration apache
    Par BOLARD dans le forum Apache
    Réponses: 3
    Dernier message: 11/05/2008, 20h38
  4. Configuration Apache&Tomcat Mod_jk
    Par PatrickC dans le forum Tomcat et TomEE
    Réponses: 1
    Dernier message: 24/09/2007, 08h39
  5. Configuration de Tomcat avec JAVA
    Par oussam dans le forum Tomcat et TomEE
    Réponses: 6
    Dernier message: 01/03/2006, 21h33

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo