2017-06-18 45 views
0

Glassfishサーバーバージョン4.1でOracle Mapviewerを実行しています。ポート8080で問題なく実行されています。オペレーティング・システムはOracle Linux 4.1.12-61.1.22.el6uek.x86_64です。 最近Apache Webサーバー2.2を使用してglassfishアプリケーションにアクセスすることにしました。これにより、柔軟性が向上します。 mod_jk 1.2がインストールされ、mod_jk.logファイルで「初期化」されているので動作しているようです。mod_jkが不正なゲートウェイを提供する

私は次のようにhttpd.confのを更新しました:

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 

マイ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 
私はまた、次のリスナーのasadminのGlassFishで作成した

​​

問題は、私はhttp://localhost/gsmapviewer/にアクセスしようとすると、私は悪いゲートウェイエラーを取得し、です。 mod_jk.logファイルで私は得る:

[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

なぜmod_jkですか? mod_proxyを使用する方が良い解決法です(はるかにクリーンで簡単です)。 mod_proxy_ajpはmod_jkバージョン2からビルドされました。 – wargre

答えて

1

私は2番目のコマンドが間違っていると思う。

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

まだ2番目のneworkリスナーが適切に機能するかどうかはわかりません。私は最初にそれを取り除かなければならないという疑いがあります。

+0

はい、2番目のリスナーを削除し、提案したコマンドを実行しました。リクエストがグラスフィッシュに転送されているように見えます。問題は今、私が "gsmapviewer"マッピングを通じて既存のプロジェクト "mapviewer"を要求しているにもかかわらず、glassfishサーバーから "要求されたリソースが利用できない"という "HTTP Status 404 - Not Found"を取得することです... –

+0

mod_jk.logとは何ですか? Webアプリケーションのコンテキストとは何ですか? – fhossfel

+0

mod_jk.logは何も言わない。コンテキストは/ mapviewer/ –

関連する問題