users@glassfish.java.net

need help with GlassFish install front-ended by Apache2 with mod_jk

From: <forums_at_java.net>
Date: Thu, 9 Feb 2012 23:44:25 -0600 (CST)

I'm tyring to do a fairly basic installation (no clustering, no
loadbalancing). I installed GlassFish 3.1.1 and set it up to work with
Apache Webserver 2.2.x using mod_jk. Everything works great when using port
8080. For example, an example hello.war application [1] deployed on GlassFish
runs fine from:

    http://www.mydomain.com:8080/hello/

 

My question is, what do I need to change (or add) such that I can access the
hello.war application using an address like this (and using port 80; closing
port 8080):

 

    http://www.mydomain.com/glassfish-test/hello/

 

The goal is to have all external traffic pass through Apache webserver port
80 to access GlassFish. Using this site's instructions [2] as inspiration, I
modified httpd.conf to include the following line (inside the pre-existing
VirtualHost tags for www.mydomain.com)

 

    JkMount /glassfish-test/* worker1

 

I *think* this means all traffic passing through Apache webserver that
includes the address `http://www.mydomain.com/glassfish-test/` will be
directed to/from GlassFish. 

 

Then I restarted Apache webserver. At this point, I'm guessing what to do
next. I take GlassFish's example hello.war file, and place it in the
following directory:

 

    ~/public_html/glassfish-test/

 

Then I issue a `jar xvf hello.war` to extract the files/directories. I then
see the following file:

 

    ~/public_html/glassfish-test/index.jsp

 

so I type the following address into the browser:

 

    http://www.mydomain.com/glassfish-test/index.jsp

 

and the website hangs (spinning wheel forever). Is trying to install the
hello.war application and/or access index.jsp this way valid (should I be
using a different URL, etc., I have no idea)? The instructions I see online
usually refer to setting up GlassFish with direct access to the external
world, whereas I'm trying to pass all traffic through Apache's port 80.

 

For reference, my httpd.conf file includes the following (among other
things):

LoadModule jk_module /etc/httpd/modules/mod_jk.so JkWorkersFile
/home/glassfish/glassfish3/glassfish/domains/domain1/config/glassfish-jk.properties
JkLogFile /etc/httpd/logs/mod_jk.log JkLogLevel debug JkLogStampFormat "[%a
%b %d %H:%M:%S %Y] " JkOptions +ForwardKeySize +ForwardURICompat
-ForwardDirectories JkRequestLogFormat "%w %V %T" ... Listen 0.0.0.0:80
and the glassfish-jk.properties file is:

worker.list=worker1 worker.worker1.type=ajp13 worker.worker1.host=localhost
worker.worker1.port=8009 maxThreads=256
Here's the mod_jk log from attempting to access
http://www.mydomain.com/glassfish-test/index.jsp (see the one error about 3/4
of the way down; it looks like there was a 30 sec timeout just before the
error; http.conf sets Timeout to 300; maybe mod_jk or GlassFish has a 30 s
timeout?)

[Thu Feb 09 16:27:16 2012] [32475:140136270534592] [debug]
map_uri_to_worker_ext::jk_uri_worker_map.c (1036): Attempting to map URI
'/glassfish-user/index.jsp' from 2 maps [Thu Feb 09 16:27:16 2012]
[32475:140136270534592] [debug] find_match::jk_uri_worker_map.c (850):
Attempting to map context URI '/glassfish-test/*=worker1' source 'JkMount'
[Thu Feb 09 16:27:16 2012] [32475:140136270534592] [debug]
find_match::jk_uri_worker_map.c (850): Attempting to map context URI
'/*.jsp=worker1' source 'JkMount' [Thu Feb 09 16:27:16 2012]
[32475:140136270534592] [debug] find_match::jk_uri_worker_map.c (863): Found
a wildchar match '/*.jsp=worker1' [Thu Feb 09 16:27:16 2012]
[32475:140136270534592] [debug] jk_handler::mod_jk.c (2522): Into handler
jakarta-servlet worker=worker1 r->proxyreq=0 [Thu Feb 09 16:27:16 2012]
[32475:140136270534592] [debug] wc_get_worker_for_name::jk_worker.c (116):
found a worker worker1 [Thu Feb 09 16:27:16 2012] [32475:140136270534592]
[debug] wc_maintain::jk_worker.c (339): Maintaining worker worker1 [Thu Feb
09 16:27:16 2012] [32475:140136270534592] [debug]
wc_get_name_for_type::jk_worker.c (293): Found worker type 'ajp13' [Thu Feb
09 16:27:16 2012] [32475:140136270534592] [debug] init_ws_service::mod_jk.c
(1024): Service protocol=HTTP/1.1 method=GET ssl=false host=(null)
addr=xxx.xxx.xxx.xxx name=www.mydomain.com port=80 auth=(null) user=(null)
laddr=xxx.xxx.xxx.xxx raddr=xxx.xxx.xxx.xxx uri=/glassfish-user/index.jsp
[Thu Feb 09 16:27:16 2012] [32475:140136270534592] [debug]
ajp_get_endpoint::jk_ajp_common.c (3161): acquired connection pool slot=0
after 0 retries [Thu Feb 09 16:27:16 2012] [32475:140136270534592] [debug]
ajp_marshal_into_msgb::jk_ajp_common.c (647): ajp marshaling done [Thu Feb 09
16:27:16 2012] [32475:140136270534592] [debug] ajp_service::jk_ajp_common.c
(2440): processing worker1 with 2 retries [Thu Feb 09 16:27:16 2012]
[32475:140136270534592] [debug] ajp_send_request::jk_ajp_common.c (1624):
(worker1) all endpoints are disconnected. [Thu Feb 09 16:27:16 2012]
[32475:140136270534592] [debug] jk_open_socket::jk_connect.c (484): socket
TCP_NODELAY set to On [Thu Feb 09 16:27:16 2012] [32475:140136270534592]
[debug] jk_open_socket::jk_connect.c (608): trying to connect socket 23 to
127.0.0.1:8009 [Thu Feb 09 16:27:16 2012] [32475:140136270534592] [debug]
jk_open_socket::jk_connect.c (634): socket 23 [127.0.0.1:33642 ->
127.0.0.1:8009] connected [Thu Feb 09 16:27:16 2012] [32475:140136270534592]
[debug] ajp_connection_tcp_send_message::jk_ajp_common.c (1195): sending to
ajp13 pos=4 len=746 max=8192 [Thu Feb 09 16:27:16 2012]
[32475:140136270534592] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (1195): 0000 12 34 02 E6 02
02 00 08 48 54 54 50 2F 31 2E 31 - .4......HTTP/1.1 [Thu Feb 09 16:27:16
2012] [32475:140136270534592] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (1195): 0010 00 00 19 2F 67
6C 61 73 73 66 69 73 68 2D 75 73 - .../glassfish-us ... <snipped to save
space> [Thu Feb 09 16:27:16 2012] [32475:140136270534592] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (1195): 02e0 56 41 54 49 4F
4E 00 FF FF FF 00 00 00 00 00 00 - VATION.......... [Thu Feb 09 16:27:16
2012] [32475:140136270534592] [debug] ajp_send_request::jk_ajp_common.c
(1684): (worker1) request body to send 0 - request body to resend 0 [Thu Feb
09 16:27:46 2012] [32475:140136270534592] [debug]
jk_shutdown_socket::jk_connect.c (731): About to shutdown socket 23
[127.0.0.1:33642 -> 127.0.0.1:8009] [Thu Feb 09 16:27:46 2012]
[32475:140136270534592] [debug] jk_is_input_event::jk_connect.c (1021): error
event during poll on socket 23 [error=107] (event=16) [Thu Feb 09 16:27:46
2012] [32475:140136270534592] [debug] jk_shutdown_socket::jk_connect.c (813):
Shutdown socket 23 [127.0.0.1:33642 -> 127.0.0.1:8009] and read 0 lingering
bytes in 0 sec. [Thu Feb 09 16:27:46 2012] [32475:140136270534592] [info]
ajp_connection_tcp_get_message::jk_ajp_common.c (1266): (worker1) can't
receive the response header message from tomcat, tomcat (127.0.0.1:8009) has
forced a connection close for socket 23 [Thu Feb 09 16:27:46 2012]
[32475:140136270534592] [error] ajp_get_reply::jk_ajp_common.c (2118):
(worker1) Tomcat is down or refused connection. No response has been sent to
the client (yet) [Thu Feb 09 16:27:46 2012] [32475:140136270534592] [info]
ajp_service::jk_ajp_common.c (2607): (worker1) sending request to tomcat
failed (recoverable), (attempt=1) [Thu Feb 09 16:27:46 2012]
[32475:140136270534592] [debug] ajp_service::jk_ajp_common.c (2461): retry 1,
sleeping for 100 ms before retrying [Thu Feb 09 16:27:46 2012]
[32475:140136270534592] [debug] ajp_send_request::jk_ajp_common.c (1624):
(worker1) all endpoints are disconnected. [Thu Feb 09 16:27:46 2012]
[32475:140136270534592] [debug] jk_open_socket::jk_connect.c (484): socket
TCP_NODELAY set to On [Thu Feb 09 16:27:46 2012] [32475:140136270534592]
[debug] jk_open_socket::jk_connect.c (608): trying to connect socket 23 to
127.0.0.1:8009 [Thu Feb 09 16:27:46 2012] [32475:140136270534592] [debug]
jk_open_socket::jk_connect.c (634): socket 23 [127.0.0.1:33646 ->
127.0.0.1:8009] connected [Thu Feb 09 16:27:46 2012] [32475:140136270534592]
[debug] ajp_connection_tcp_send_message::jk_ajp_common.c (1195): sending to
ajp13 pos=4 len=746 max=8192 [Thu Feb 09 16:27:46 2012]
[32475:140136270534592] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (1195): 0000 12 34 02 E6 02
02 00 08 48 54 54 50 2F 31 2E 31 - .4......HTTP/1.1 [Thu Feb 09 16:27:46
2012] [32475:140136270534592] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (1195): 0010 00 00 19 2F 67
6C 61 73 73 66 69 73 68 2D 75 73 - .../glassfish-us ... <snipped to save
space> [Thu Feb 09 16:27:46 2012] [32475:140136270534592] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (1195): 02e0 56 41 54 49 4F
4E 00 FF FF FF 00 00 00 00 00 00 - VATION..........
Note that I also issue the following commands:

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

 

 
 


[1] http://docs.oracle.com/cd/E19798-01/821-1757/geyvr/index.html
[2] http://www.codefactorycr.com/glassfish-behind-apache.html

--
[Message sent by forum member 'gkk_gf']
View Post: http://forums.java.net/node/883417