You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mayuresh <ma...@gmail.com> on 2015/04/22 11:33:10 UTC

Getting Apache 2.2.29 to work with tomcat 8.0.21 using mod_jk 1.2.40 on a mac

Hi Gurus,

i am trying to make this combination and am stumbled at a place. After a
lot of searching and experimenting I finally decided to post this question
here.

I am trying to load a page which loads just fine directly on tomcat.
However if I try to load it through the Apache web server, it fails with a
502 on apache (400 on tomcat)

For an unsuccessful request through apache I see the following in the logs,
where all the headers seem to be garbled:
22-Apr-2015 01:53:46.656 FINE [http-nio-8080-exec-1]
org.apache.tomcat.util.modeler.BaseModelMBean.preRegister preRegister
org.apache.coyote.RequestInfo@616702aa
Catalina:type=RequestProcessor,worker="http-nio-8080",name=HttpRequest1
22-Apr-2015 01:53:46.657 FINE [http-nio-8080-exec-1]
org.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine Received
[^R4^B^G^B^B^@^HHTTP/1.1^@^@^M/greeting/abc^@^@
 10.0.0.23^@ÿÿ^@^Posxltmkshi.local^@&ü^@^@
 ^K^@^Uosxltmkshi.local:9980^@ ^F^@
keep-alive^@ ^L^@^Hno-cache^@^@^MCache-Control^@^@^Hno-cache^@
^A^@Jtext/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8^@
^N^@wMozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/42.0.2311.90
Safari/537.36^@^@^OAccept-Encoding^@^@^Sgzip, deflate,
sdch^@^@^OAccept-Language^@^@^Nen-US,en;q=0.8^@^@^OX-Forwarded-For^@^@^L14.102.224.6^@
^H^@^A0^@
^@^OAJP_REMOTE_PORT^@^@^E55806^@
^@^PJK_LB_ACTIVATION^@^@^CACT^@ÿ]

0:0:0:0:0:0:0:1 - - [22/Apr/2015:01:47:03 -0700] "-" 400 -

For Successful page load directly through tomcat I see the following in the
log:
22-Apr-2015 01:48:56.176 FINE [http-nio-8080-exec-1]
org.apache.tomcat.util.modeler.modules.MbeansDescriptorsIntrospectionSource.createManagedBean
Setting name: org.apache.coyote.RequestInfo
22-Apr-2015 01:48:56.176 FINE [http-nio-8080-exec-1]
org.apache.tomcat.util.modeler.BaseModelMBean.preRegister preRegister
org.apache.coyote.RequestInfo@630018d0
Catalina:type=RequestProcessor,worker="http-nio-8080",name=HttpRequest1
22-Apr-2015 01:48:56.178 FINE [http-nio-8080-exec-1]
org.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine Received
[GET /greeting/abcde HTTP/1.1^M
Host: localhost:8080^M
Connection: keep-alive^M
Cache-Control: max-age=0^M
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8^M
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36^M
Accept-Encoding: gzip, deflate, sdch^M
Accept-Language: en-US,en;q=0.8^M
Cookie: JSESSIONID=CB0590CD16933826596C4E78AE4FDB5F^M
X-Forwarded-For: 14.102.224.6^M
^M
]

127.0.0.1 - - [22/Apr/2015:01:48:56 -0700] "GET /greeting/abcde HTTP/1.1"
200 1726
127.0.0.1 - - [22/Apr/2015:01:49:00 -0700] "GET /greetingab.js HTTP/1.1"
200 4

I can't seem to find why this is happening. Can you please help me figure
out what the problem might be?

Thanks,
Mayuresh

Re: Getting Apache 2.2.29 to work with tomcat 8.0.21 using mod_jk 1.2.40 on a mac

Posted by Mayuresh <ma...@gmail.com>.
Thanks a lot *Neven *and* Rainer*!! That was my problem!! I changed the
worker port to 8009 and everything is good.

Thanks for your help!!

On Wed, Apr 22, 2015 at 4:46 AM, Rainer Jung <ra...@kippdata.de>
wrote:

> Am 22.04.2015 um 11:33 schrieb Mayuresh:
>
>> Hi Gurus,
>>
>> i am trying to make this combination and am stumbled at a place. After a
>> lot of searching and experimenting I finally decided to post this question
>> here.
>>
>> I am trying to load a page which loads just fine directly on tomcat.
>> However if I try to load it through the Apache web server, it fails with a
>> 502 on apache (400 on tomcat)
>>
>> For an unsuccessful request through apache I see the following in the
>> logs,
>> where all the headers seem to be garbled:
>> 22-Apr-2015 01:53:46.656 FINE [http-nio-8080-exec-1]
>> org.apache.tomcat.util.modeler.BaseModelMBean.preRegister preRegister
>> org.apache.coyote.RequestInfo@616702aa
>> Catalina:type=RequestProcessor,worker="http-nio-8080",name=HttpRequest1
>> 22-Apr-2015 01:53:46.657 FINE [http-nio-8080-exec-1]
>> org.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine Received
>> [^R4^B^G^B^B^@^HHTTP/1.1^@^@^M/greeting/abc^@^@
>>   10.0.0.23^@ÿÿ^@^Posxltmkshi.local^@&ü^@^@
>>   ^K^@^Uosxltmkshi.local:9980^@ ^F^@
>> keep-alive^@ ^L^@^Hno-cache^@^@^MCache-Control^@^@^Hno-cache^@
>>
>> ^A^@Jtext/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8^@
>> ^N^@wMozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36
>> (KHTML, like Gecko) Chrome/42.0.2311.90
>> Safari/537.36^@^@^OAccept-Encoding^@^@^Sgzip, deflate,
>>
>> sdch^@^@^OAccept-Language^@^@^Nen-US,en;q=0.8^@^@^OX-Forwarded-For^@^@^L14.102.224.6^@
>> ^H^@^A0^@
>> ^@^OAJP_REMOTE_PORT^@^@^E55806^@
>> ^@^PJK_LB_ACTIVATION^@^@^CACT^@ÿ]
>>
>
> mod_jk talks the AJP protocol, so you need to connect it to the Tomcat AJP
> connector. You instead connected it to the Tomcat HTTP connector. You
> probably have configured port 8080 in the mod_jk config instead of 8009
> (default AJP port in Tomcat default server.xml).
>
> Regards,
>
> Rainer
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
-Mayuresh

Re: Getting Apache 2.2.29 to work with tomcat 8.0.21 using mod_jk 1.2.40 on a mac

Posted by Rainer Jung <ra...@kippdata.de>.
Am 22.04.2015 um 11:33 schrieb Mayuresh:
> Hi Gurus,
>
> i am trying to make this combination and am stumbled at a place. After a
> lot of searching and experimenting I finally decided to post this question
> here.
>
> I am trying to load a page which loads just fine directly on tomcat.
> However if I try to load it through the Apache web server, it fails with a
> 502 on apache (400 on tomcat)
>
> For an unsuccessful request through apache I see the following in the logs,
> where all the headers seem to be garbled:
> 22-Apr-2015 01:53:46.656 FINE [http-nio-8080-exec-1]
> org.apache.tomcat.util.modeler.BaseModelMBean.preRegister preRegister
> org.apache.coyote.RequestInfo@616702aa
> Catalina:type=RequestProcessor,worker="http-nio-8080",name=HttpRequest1
> 22-Apr-2015 01:53:46.657 FINE [http-nio-8080-exec-1]
> org.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine Received
> [^R4^B^G^B^B^@^HHTTP/1.1^@^@^M/greeting/abc^@^@
>   10.0.0.23^@ÿÿ^@^Posxltmkshi.local^@&ü^@^@
>   ^K^@^Uosxltmkshi.local:9980^@ ^F^@
> keep-alive^@ ^L^@^Hno-cache^@^@^MCache-Control^@^@^Hno-cache^@
> ^A^@Jtext/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8^@
> ^N^@wMozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36
> (KHTML, like Gecko) Chrome/42.0.2311.90
> Safari/537.36^@^@^OAccept-Encoding^@^@^Sgzip, deflate,
> sdch^@^@^OAccept-Language^@^@^Nen-US,en;q=0.8^@^@^OX-Forwarded-For^@^@^L14.102.224.6^@
> ^H^@^A0^@
> ^@^OAJP_REMOTE_PORT^@^@^E55806^@
> ^@^PJK_LB_ACTIVATION^@^@^CACT^@ÿ]

mod_jk talks the AJP protocol, so you need to connect it to the Tomcat 
AJP connector. You instead connected it to the Tomcat HTTP connector. 
You probably have configured port 8080 in the mod_jk config instead of 
8009 (default AJP port in Tomcat default server.xml).

Regards,

Rainer


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


Re: Getting Apache 2.2.29 to work with tomcat 8.0.21 using mod_jk 1.2.40 on a mac

Posted by Neven Cvetkovic <ne...@gmail.com>.
Hey Mayuresh,


On Wed, Apr 22, 2015 at 5:33 AM, Mayuresh <ma...@gmail.com>
wrote:

> Hi Gurus,
>
> i am trying to make this combination and am stumbled at a place. After a
> lot of searching and experimenting I finally decided to post this question
> here.
>

Welcome to the mailing list!


>
> I am trying to load a page which loads just fine directly on tomcat.
> However if I try to load it through the Apache web server, it fails with a
> 502 on apache (400 on tomcat)
>
> For an unsuccessful request through apache I see the following in the logs,
> where all the headers seem to be garbled:
> 22-Apr-2015 01:53:46.656 FINE [http-nio-8080-exec-1]
>

Right there - you are using HTTP connector to serve this request, as
indicated by the thread name (http-nio-bio-exec-1).

What is your relevant Apache (httpd) configuration for forwarding to
Tomcat, e.g. your worker file that defines how the traffic is routed to
tomcat instance, the mount point that defines how certain url is registered
with different workers, etc...

Typically you would connect to port 8009 (AJP) if you are connecting
through MOD_JK Apache (httpd) module, i.e.

worker.XXXX.type=ajp
worker.XXXX.host=localhost
worker.XXXX.port=8009 (my suspicion is that you have 8080 defined here)

See more information on workers file here:
https://tomcat.apache.org/connectors-doc/reference/workers.html


org.apache.tomcat.util.modeler.BaseModelMBean.preRegister preRegister
> org.apache.coyote.RequestInfo@616702aa
> Catalina:type=RequestProcessor,worker="http-nio-8080",name=HttpRequest1
> 22-Apr-2015 01:53:46.657 FINE [http-nio-8080-exec-1]
> org.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine Received
> [^R4^B^G^B^B^@^HHTTP/1.1^@^@^M/greeting/abc^@^@
>  10.0.0.23^@ÿÿ^@^Posxltmkshi.local^@&ü^@^@
>  ^K^@^Uosxltmkshi.local:9980^@ ^F^@
> keep-alive^@ ^L^@^Hno-cache^@^@^MCache-Control^@^@^Hno-cache^@
>
> ^A^@Jtext/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8^@
> ^N^@wMozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36
> (KHTML, like Gecko) Chrome/42.0.2311.90
> Safari/537.36^@^@^OAccept-Encoding^@^@^Sgzip, deflate,
>
> sdch^@^@^OAccept-Language^@^@^Nen-US,en;q=0.8^@^@^OX-Forwarded-For^@^@^L14.102.224.6^@
> ^H^@^A0^@
> ^@^OAJP_REMOTE_PORT^@^@^E55806^@
> ^@^PJK_LB_ACTIVATION^@^@^CACT^@ÿ]
>
> 0:0:0:0:0:0:0:1 - - [22/Apr/2015:01:47:03 -0700] "-" 400 -
>
> For Successful page load directly through tomcat I see the following in the
> log:
> 22-Apr-2015 01:48:56.176 FINE [http-nio-8080-exec-1]
>
> org.apache.tomcat.util.modeler.modules.MbeansDescriptorsIntrospectionSource.createManagedBean
> Setting name: org.apache.coyote.RequestInfo
> 22-Apr-2015 01:48:56.176 FINE [http-nio-8080-exec-1]
> org.apache.tomcat.util.modeler.BaseModelMBean.preRegister preRegister
> org.apache.coyote.RequestInfo@630018d0
> Catalina:type=RequestProcessor,worker="http-nio-8080",name=HttpRequest1
> 22-Apr-2015 01:48:56.178 FINE [http-nio-8080-exec-1]
> org.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine Received
> [GET /greeting/abcde HTTP/1.1^M
> Host: localhost:8080^M
> Connection: keep-alive^M
> Cache-Control: max-age=0^M
> Accept:
>
> text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8^M
> User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5)
> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36^M
> Accept-Encoding: gzip, deflate, sdch^M
> Accept-Language: en-US,en;q=0.8^M
> Cookie: JSESSIONID=CB0590CD16933826596C4E78AE4FDB5F^M
> X-Forwarded-For: 14.102.224.6^M
> ^M
> ]
>
> 127.0.0.1 - - [22/Apr/2015:01:48:56 -0700] "GET /greeting/abcde HTTP/1.1"
> 200 1726
> 127.0.0.1 - - [22/Apr/2015:01:49:00 -0700] "GET /greetingab.js HTTP/1.1"
> 200 4
>
> I can't seem to find why this is happening. Can you please help me figure
> out what the problem might be?
>
>
So, let us know how are you connecting your Apache (httpd) to Tomcat
instance. That's a good starting point for investigation.

Cheers!
Neven