You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by mo...@comcast.net on 2012/02/12 00:35:58 UTC

desperate for help to set up straightforward mod_jk connection between Apache2 webserver and web container


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) 
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 


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 name@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 name@address.com 
</VirtualHost> 
<VirtualHost xx.xxx.xxx.xxx:80> 
ServerName mydomain.com 
ServerAlias www.mydomain.com 
DocumentRoot /home/gkk/public_html 
ServeAdmin webmaster@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 ... 

RE: desperate for help to set up straightforward mod_jk connection between Apache2 webserver and web container

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: modjklist@comcast.net [mailto:modjklist@comcast.net] 
> Subject: Re: desperate for help to set up straightforward 
> mod_jk connection between Apache2 webserver and web container

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

It is a fork, and is significantly different from Tomcat at this point.  Best if you can reproduce the problem with a current version of Tomcat.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


Re: desperate for help to set up straightforward mod_jk connection between Apache2 webserver and web container

Posted by John Renne <jo...@gniffelnieuws.net>.
> 
> asadmin> create-http-listener --listenerport 8009 --listeneraddress 0.0.0.0 --defaultvs server jk-connector --port 4850 
> 
So you're creating a listener called jk-connector (why do you add the -port 4850 btw?
> 
> 
> asadmin> create-network-listener --protocol http-listener-1 --listenerport 8009 --jkenabled true jk-connector --port 4850 
> 
And you create another listener again with the same listenerport, and again the port 4850  and again call it jk-connector?

> 
> 
> 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 
> 
And what would be in this configfile?

The last time I looked at glassfish it was fairly straightforward to enable an AJP connector using the commands below:
asaadmin create-http-listeren --listenerport 8009 --listerenaddress 0.0.0.0 --defaultvs server jk-connector
adaadmin set configs.config.server-config.network-config.network-listeners.network-listener.jk-connector.jk-enabled=true

After restarting glassfish you might also  check if port 8009 is accepting connections. If it doesn't, I'ld advise you to go to a glassfish mailing list and try your luck there. 

John


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


Re: desperate for help to set up straightforward mod_jk connection between Apache2 webserver and web container

Posted by André Warnier <aw...@ice-sa.com>.
Hi.
Basically, many people here wouldn't know Glassfish, and would not know how in Glassfish 
one sets up a <Connector> (if they are called that way in Glassfish) listening on port 
8009 AND expecting AJP as a protocol.

I know even less of Glassfish, but the kind of messages shown in the mod_jk log look like 
they may be the result of trying to communicate from mod_jk, using the AJP protocol, to a 
port 8009 which is listening (it seems to accept a connection), but doesn't understand the 
AJP protocol and thus closes the connection before anything has really happened.

But again, this is just a guess.

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


Re: desperate for help to set up straightforward mod_jk connection between Apache2 webserver and web container

Posted by Rainer Jung <ra...@kippdata.de>.
On 12.02.2012 01:44, modjklist@comcast.net wrote:
> For example, if a socket connection is established and AJP transmission occurs, even though it's only one way, would GlassFish have to be listening for this to happen? Would GlassFish have to reply via AJP to establish a socket? That sort of thing. What does the log file tell us about the communication between Apache and GlassFish, and what does it not tell that we would need to know to pinpoint the problem, etc.?

Yes, without Glassfish at least listening to 8009 you would have seen 
something different in the mod_jk logs, namely an error during connect 
and not a message that says it is sending a request there.

Since you built mod_jk from source: the source distribution contains a 
nice httpd-jk.conf and workers.properties file which is a good starting 
point for configuration. I'm not saying it will fix your problem, 
because it really looks it is on the Glassfish side, but e.g. that 
configuration contains a cping/cpong test for every new configuration. 
If cping/cpong already fails, it would be likely that Glassfish is 
listening on the port but doesn't expect AJP13 as the protocol etc.

The log message from Glassfish you posted indicates, that Glassfish 
thinks it never received a valid request and thus closed the "idle" 
connection after 30 seconds. So either something eats the packet in 
between Apache and Glassfish (not very likely on localhost, since you 
could establish the connection), or the request is buggy, e.g. contains 
invalid headers like a wrong content-length making Glassfish to wait for 
more data.

Unfortunately you dropped that part of mod_jk debug output as "hex data" 
:( When increasing JkLogLevel to "trace" mod_jk will do a full dump of 
the request. Using "debug" will only dome the first one or two KB of 
each packet.

Regards,

Rainer

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


Re: desperate for help to set up straightforward mod_jk connection between Apache2 webserver and web container

Posted by mo...@comcast.net.
Thanks everyone, some more info: 


1. Note that over the last week I've submitted to GlassFish forum here: 


http://www.java.net/forum/topic/glassfish/glassfish/need-help-glassfish-install-front-ended-apache2-modjk#comment-822040 


to serverfault here: 


http://serverfault.com/questions/359218/mod-jk-log-error-message-what-does-it-hint-might-be-the-issue 


to stackoverflow here: 


http://stackoverflow.com/questions/9220969/access-web-container-through-apache-webserver-port-80-using-mod-jk 




but didn't get much feedback. I submitted here because I was hoping someone with mod_jk experience could interpret the log file lines below as to what it means, and brainstorm what could potentially be causing such an error. I don't know if the GlassFish folks would be as knowledgeable here. 


For example, if a socket connection is established and AJP transmission occurs, even though it's only one way, would GlassFish have to be listening for this to happen? Would GlassFish have to reply via AJP to establish a socket? That sort of thing. What does the log file tell us about the communication between Apache and GlassFish, and what does it not tell that we would need to know to pinpoint the problem, etc.? 


2. Note that port 4850 is an administrator port open simply for web-console administration of GlassFish (it can also be accessed from command line). 


3. Note that I can use netstat to verify tcp connection status ESTABLISHED in both directions (Apache to GlassFish, and GlassFish to Apache). 

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

On 12 Feb 2012, at 00:03, "modjklist@comcast.net" <mo...@comcast.net> wrote: 

> 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): 

Sorry, I'm on an iPhone. Opening a 150+ page PDF is a bit unappealing. 


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

Nothing like Tomcat then... 

> 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 

>From the above it's not clear to me whether AJP is running on port 
8009 or port 4580. 

As your minimal mod_jk config looks OK at first glance I'd suggest you 
need help from the Glassfish community. 

Or you could install Tomcat instead. 


p 


> 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 *" <pi...@pidster.com> 
> To: "Tomcat Users List" <us...@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, "modjklist@comcast.net" <mo...@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 name@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 name@address.com 
> </VirtualHost> 
> <VirtualHost xx.xxx.xxx.xxx:80> 
> ServerName mydomain.com 
> ServerAlias www.mydomain.com 
> DocumentRoot /home/gkk/public_html 
> ServeAdmin webmaster@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-unsubscribe@tomcat.apache.org 
> For additional commands, e-mail: users-help@tomcat.apache.org 

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


Re: desperate for help to set up straightforward mod_jk connection between Apache2 webserver and web container

Posted by Pid * <pi...@pidster.com>.
On 12 Feb 2012, at 00:03, "modjklist@comcast.net" <mo...@comcast.net> wrote:

> 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):

Sorry, I'm on an iPhone. Opening a 150+ page PDF is a bit unappealing.


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

Nothing like Tomcat then...

> 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

>From the above it's not clear to me whether AJP is running on port
8009 or port 4580.

As your minimal mod_jk config looks OK at first glance I'd suggest you
need help from the Glassfish community.

Or you could install Tomcat instead.


p


> 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 *" <pi...@pidster.com>
> To: "Tomcat Users List" <us...@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, "modjklist@comcast.net" <mo...@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 name@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 name@address.com
> </VirtualHost>
> <VirtualHost xx.xxx.xxx.xxx:80>
> ServerName mydomain.com
> ServerAlias www.mydomain.com
> DocumentRoot /home/gkk/public_html
> ServeAdmin webmaster@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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org

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


Re: desperate for help to set up straightforward mod_jk connection between Apache2 webserver and web container

Posted by mo...@comcast.net.
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 *" <pi...@pidster.com> 
To: "Tomcat Users List" <us...@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, "modjklist@comcast.net" <mo...@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 name@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 name@address.com 
</VirtualHost> 
<VirtualHost xx.xxx.xxx.xxx:80> 
ServerName mydomain.com 
ServerAlias www.mydomain.com 
DocumentRoot /home/gkk/public_html 
ServeAdmin webmaster@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-unsubscribe@tomcat.apache.org 
For additional commands, e-mail: users-help@tomcat.apache.org 

Re: desperate for help to set up straightforward mod_jk connection between Apache2 webserver and web container

Posted by Pid * <pi...@pidster.com>.
On 11 Feb 2012, at 23:36, "modjklist@comcast.net" <mo...@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 name@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 name@address.com
    </VirtualHost>
    <VirtualHost xx.xxx.xxx.xxx:80>
        ServerName mydomain.com
        ServerAlias www.mydomain.com
        DocumentRoot /home/gkk/public_html
        ServeAdmin webmaster@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org