2017-06-18 1 views
0

J'ai mapviewer Oracle en cours d'exécution sur le serveur glassfish version 4.1. Il a fonctionné sans problèmes sur le port 8080. Le système d'exploitation est Oracle Linux 4.1.12-61.1.22.el6uek.x86_64. Récemment, nous avons décidé d'accéder aux applications glassfish via le serveur web Apache, version 2.2, pour avoir une plus grande flexibilité. Mod_jk 1.2 a été installé et semble fonctionner depuis que je suis "initialisé" dans le fichier mod_jk.log.mod_jk donne Bad passerelle

J'ai mis à jour httpd.conf ce qui suit:

LoadModule jk_module modules/mod_jk.so 

# We need a workers file exactly once 
# and in the global server 
JkWorkersFile conf/workers.properties 

# Our JK error log 
# You can (and should) use rotatelogs here 
JkLogFile logs/mod_jk.log 

# Our JK log level (trace,debug,info,warn,error) 
JkLogLevel info 

# Our JK shared memory file 
JkShmFile logs/mod_jk.shm 

# Define a new log format you can use in any CustomLog in order 
# to add mod_jk specific information to your access log. 
# LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Cookie}i\" \"%{Set-Cookie}o\" %{pid}P %{tid}P %{JK_LB_FIRST_NAME}n %{JK_LB_LAST_NAME}n ACC %{JK_LB_LAST_ACCESSED}n ERR %{JK_LB_LAST_ERRORS}n BSY %{JK_LB_LAST_BUSY}n %{JK_LB_LAST_STATE}n %D" extended_jk 

# This option will reject all requests, which contain an 
# encoded percent sign (%25) or backslash (%5C) in the URL 
# If you are sure, that your webapp doesn't use such 
# URLs, enable the option to prevent double encoding attacks. 
# Since: 1.2.24 
# JkOptions +RejectUnsafeURI 

# This option will collapse multiple adjacent slashes 
# in request URLs before looking for mount or unmount 
# matches. 
# Since: 1.2.41 
# JkOptions +CollapseSlashesAll 

# After setting JkStripSession to "On", mod_jk will 
# strip all ";jsessionid=..." from request URLs it 
# does *not* forward to a backend. 
# This is useful, if all links in a webapp use 
# URLencoded session IDs and parts of the static 
# content should be delivered directly by Apache. 
# Of course you can also do it with mod_rewrite. 
# Since: 1.2.21 
# JkStripSession On 

# Start a separate thread for internal tasks like 
# idle connection probing, connection pool resizing 
# and load value decay. 
# Run these tasks every JkWatchdogInterval seconds. 
# Since: 1.2.27 
JkWatchdogInterval 60 

# Configure access to jk-status and jk-manager 
# If you want to make this available in a virtual host, 
# either move this block into the virtual host 
# or copy it logically there by including "JkMountCopy On" 
# in the virtual host. 
# Add an appropriate authentication method here! 
<Location /jk-status> 
    # Inside Location we can omit the URL in JkMount 
    JkMount jk-status 
    Order deny,allow 
    Deny from all 
    Allow from 127.0.0.1 
</Location> 
<Location /jk-manager> 
    # Inside Location we can omit the URL in JkMount 
    JkMount jk-manager 
    Order deny,allow 
    Deny from all 
    Allow from 127.0.0.1 
</Location> 

#<Location /mapviewer> 
# # Inside Location we can omit the URL in JkMount 
# JkMount mapviewer 
# Order deny,allow 
# Deny from all 
# Allow from 127.0.0.1 
#</Location> 

# If you want to put all mounts into an external file 
# that gets reloaded automatically after changes 
# (with a default latency of 1 minute), 
# you can define the name of the file here. 
# JkMountFile conf/extra/uriworkermap.properties 

# Send all /mapviewer/ requests to Glassfish. 
JkMount /gsmapviewer/* mapviewer 

# Example for Mounting a context to the worker "balancer" 
# The URL syntax "a|b" instantiates two mounts at once, 
# the first one is "a", the second one is "ab". 
# JkMount /myapp|/* balancer 

# Example for UnMounting requests for all workers 
# using a simple URL pattern 
# Since: 1.2.26 
# JkUnMount /myapp/static/* * 

# Example for UnMounting requests for a named worker 
# JkUnMount /myapp/images/* balancer 

# Example for UnMounting requests using regexps 
# SetEnvIf REQUEST_URI "\.(htm|html|css|gif|jpg|js)$" no-jk 

# Example for setting a reply timeout depending on the request URL 
# Since: 1.2.27 
# SetEnvIf Request_URI "/transactions/" JK_REPLY_TIMEOUT=600000 

# Example for disabling reply timeouts for certain request URLs 
# Since: 1.2.27 
# SetEnvIf Request_URI "/reports/" JK_REPLY_TIMEOUT=0 

# IMPORTANT: Mounts and virtual hosts 
# If you are using VirtualHost elements, you 
# - can put mounts only used in some virtual host into its VirtualHost element 
# - can copy all global mounts to it using "JkMountCopy On" inside the VirtualHost 
# - can copy all global mounts to all virtual hosts by putting 
# "JkMountCopy All" into the global server 
# Since: 1.2.26 

Mon fichier workers.properties:

worker.list=jk-status 
worker.jk-status.type=status 

worker.jk-status.read_only=true 

worker.list=jk-manager 
worker.jk-manager.type=status 

worker.list=mapviewer 

# Mapviewer worker. 
worker.mapviewer.host=localhost 
worker.mapviewer.port=8009 
worker.mapviewer.type=ajp13 
worker.mapviewer.lbfactor=1 

# Activation allows to configure 
# whether this node should actually be used 
# A: active (use node fully) 
# D: disabled (only use, if sticky session needs this node) 
# S: stopped (do not use) 
# Since: 1.2.19 
worker.mapviewer.activation=A 

J'ai aussi créé en GlassFish asadmin les auditeurs suivants:

create-http-listener --listenerport 8009 --listeneraddress 0.0.0.0 --defaultvs server jk-http 
create-network-listener --protocol http-listener-1 --listenerport 8009 --jkenabled true jk-connector 

Le problème est, lorsque je tente d'accéder http://localhost/gsmapviewer/, je reçois une erreur de passerelle Bad. Dans le fichier mod_jk.log, j'obtiens:

[Sun Jun 18 10:51:47.024 2017] [29684:140425951717344] [info] init_jk::mod_jk.c (3595): mod_jk/1.2.42 initialized 
[Sun Jun 18 10:52:23.033 2017] [4781:140425951717344] [info] ajp_connection_tcp_get_message::jk_ajp_common.c (1342): (mapviewer) can't receive the response header message from tomcat, tomcat (127.0.0.1:8009) has forced a connection close for socket 14 
[Sun Jun 18 10:52:24.379 2017] [4781:140425951717344] [error] ajp_get_reply::jk_ajp_common.c (2259): (mapviewer) Tomcat is down or refused connection. No response has been sent to the client (yet) 
[Sun Jun 18 10:52:24.379 2017] [4781:140425951717344] [info] ajp_service::jk_ajp_common.c (2778): (mapviewer) sending request to tomcat failed (recoverable), (attempt=1) 
[Sun Jun 18 10:52:55.038 2017] [4781:140425951717344] [info] ajp_connection_tcp_get_message::jk_ajp_common.c (1342): (mapviewer) can't receive the response header message from tomcat, tomcat (127.0.0.1:8009) has forced a connection close for socket 14 
[Sun Jun 18 10:52:55.038 2017] [4781:140425951717344] [error] ajp_get_reply::jk_ajp_common.c (2259): (mapviewer) Tomcat is down or refused connection. No response has been sent to the client (yet) 
[Sun Jun 18 10:52:55.038 2017] [4781:140425951717344] [info] ajp_service::jk_ajp_common.c (2778): (mapviewer) sending request to tomcat failed (recoverable), (attempt=2) 
[Sun Jun 18 10:52:55.038 2017] [4781:140425951717344] [error] ajp_service::jk_ajp_common.c (2799): (mapviewer) connecting to tomcat failed (rc=0, errors=1, client_errors=0). 
[Sun Jun 18 10:52:55.038 2017] [4781:140425951717344] [info] jk_handler::mod_jk.c (2995): Service error=0 for worker=mapviewer 
+0

Pourquoi mod_jk? utilisez mod_proxy c'est une meilleure solution (beaucoup plus propre et beaucoup plus facile). Le mod_proxy_ajp a été construit à partir de la version 2 de mod_jk. – wargre

Répondre

1

Je pense que la deuxième commande est fausse. Il devrait être

asadmin set server-config.network-config.network-listeners.network-listener.http-jk.jk-enabled=true 

Je ne sais pas si cela fonctionne toujours avec le deuxième écouteur d'nework en place. J'ai le soupçon que vous devez enlever cela en premier.

+0

Oui, j'ai supprimé le second écouteur et exécuté la commande que vous avez suggérée. Maintenant, il semble que la demande soit transmise à glassfish. Le problème est maintenant que je reçois un "HTTP Status 404 - Not Found" du serveur glassfish disant que "la ressource demandée n'est pas disponible", même si je demande un projet existant "mapviewer" via le mapping "gsmapviewer" ... –

+0

Que dit mod_jk.log? Quel est le contexte de votre application Web appelée? – fhossfel

+0

mod_jk.log ne dit rien. Le contexte est/mapviewer/ –