Hi Pid, 

1. When I say GlassFish embeds Tomcat I just mean it's derived from Tomcat 
(could be fork, etc.) 


2. I should have mentioned the configuration for GlassFish to talk to mod_jk. I 
used the example in the admin's document (go here: 
http://docs.oracle.com/cd/E18930_01/html/821-2416/ and click on PDF link, turn 
to page 150. This starts the section "To enable mod_jk" which I've been 
following to the letter. Specifically see steps 5 and 6 on page 151, and 
summarized below as): 




asadmin> create-http-listener --listenerport 8009 --listeneraddress 0.0.0.0 
--defaultvs server jk-connector --port 4850 



asadmin> create-network-listener --protocol http-listener-1 --listenerport 8009 
--jkenabled true jk-connector --port 4850 



asadmin> set 
server-config.network-config.network-listeners.network-listener.jk-connector.jk-configuration-file=/home/glassfish/glassfish3/glassfish/domains/domain1/config/glassfish-jk.properties
 --port 4850 


3. When I look at the Glassfish server log, it has the following warning 
triggered at the exact time of the 30 second timeout seen in the mod_jk.log 
file below. 


[#|2012-02-11T15:44:03.620-0800|WARNING|glassfish3.1.1|com.sun.grizzly.config.GrizzlyServiceListener|_ThreadID=14;_ThreadName=Thread-2;|GRIZZLY0023:
 Interrupting idle Thread: http-thread-pool-8009(4).|#] 


----- Original Message -----
From: "Pid *" <p...@pidster.com> 
To: "Tomcat Users List" <users@tomcat.apache.org> 
Sent: Saturday, February 11, 2012 3:44:12 PM 
Subject: Re: desperate for help to set up straightforward mod_jk connection 
between Apache2 webserver and web container 

On 11 Feb 2012, at 23:36, "modjkl...@comcast.net" <modjkl...@comcast.net> 
wrote: 

I'm trying to get Apache2 Webserver talking to Glassfish3 using mod_jk on 
CentOS, where everything is a fresh install (new server), no load 
balancing, no clustering, and everything is all on one server (so no 
firewall between Apache and Glassfish). I'm quite desperate to get this 
working, and embarrased how long I'm spending on this with no end in sight. 
I'm a newbie so watch out for potentially something obvious. 

My system (I SSH into it from remote client): 

1. new CentOS 6.2 server 
2. Sun Java 1.6.0_30 
3. mod_jk.so built from tomcat-connectors-1.2.32-src.tar 
4. GlassFish 3.1.1 (note: Glassfish Embeds Tomcat) 


Does it? I thought it was a fork, but I could be wrong... 


5. Apache Webserver 2.2.21 

Everything works great when using port 8080. For example, an example 
hello.war application ( 
http://docs.oracle.com/cd/E19798-01/821-1757/geyvr/index.html) 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; so 
I can eventually close port 8080)? 


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

The goal is to have all external traffic pass through Apache webserver port 
80 to access GlassFish. For what it's worth, I used this site's 
instructions (http://www.codefactorycr.com/glassfish-behind-apache.html) as 
inspiration. 

When I restart Apache webserver and go to: 

http://www.mydomain.com/hello 

the website hangs (spinning wheel for 30s). What could be the problem? To 
confuse things, GlassFish 3.1.1 has a bug that leads to a "error decoding 
request" in the server log. I don't see this error in the server log. 
Nevertheless, I downloaded the bug fix file and I'm using it. It didn't 
change anything, still same error shown below. This bug is documented here: 
http://java.net/jira/browse/GLASSFISH-17068?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel
 


How have you configured Glassfish to listen for AJP connections on port 
8009? 


p 




Any help MUCH MUCH MUCH appreciated! 

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

LoadModule jk_module /etc/httpd/modules/mod_jk.so 
JkWorkersFile /etc/httpd/conf/workers.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 
User nobody 
Group nobody 
ExtendedStatus On 
ServerAdmin n...@address.com 
ServerName host3.mydomain.com 
LogLevel warn 
Timeout 300 
ServerSignature On 
RewriteEngine On 
RewriteMap LeechProtect prg:/usr/local/cpanel/bin/leechprotect 
RewriteLock /usr/local/apache/logs/rewrite_lock 
UserDir public_html 

... 
NameVirtualHost xx.xxx.xxx.xxx:80 
NameVirtualHost * 
<VirtualHost *> 
ServerName host3.mydomain.com 
DocumentRoot /usr/local/apache/htdocs 
ServerAdmin n...@address.com 
</VirtualHost> 
<VirtualHost xx.xxx.xxx.xxx:80> 
ServerName mydomain.com 
ServerAlias www.mydomain.com 
DocumentRoot /home/gkk/public_html 
ServeAdmin webmas...@mydomain.com 
UseCanonicalName Off 
Include "/user/local/apache/conf/userdata/std/2/gkk/ 
mydomain.com/*.conf" 
</VirtualHost> 

the file /user/local/apache/conf/userdata/std/2/gkk/ 
mydomain.com/includethis.conf is as follows: 

JkMount /hello/* worker1 
JkMount /hello worker1 

and the glassfish-jk.properties file is: 

worker.list=worker1 
worker.worker1.type=ajp13 
worker.worker1.host=localhost 
worker.worker1.port=8009 

Here's the mod_jk log snippet (also attached for better readability) from 
attempting to access http://www.mydomain.com/hello (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 300s; maybe mod_jk or GlassFish has a 
30s timeout?): 

[Thu Feb 09 16:27:16 2012] [32475:140136270534592] [debug] 
find_match::jk_uri_worker_map.c (863): Found a wildchar match 
'/hello=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 
... <snipped to save space: this is all hex message stuff> 
[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.......... 
... and so on ... 


--------------------------------------------------------------------- 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org 
For additional commands, e-mail: users-h...@tomcat.apache.org 

Reply via email to