tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Redding <t...@tribalddb.co.uk>
Subject Re: Apache/mod_jk serves random files from tomcat
Date Thu, 17 Jul 2008 15:27:52 GMT

I now have logs from both the Apache server and Tomcat.   I'm a little unsure
how to interpret these log files. It shows that Tomcat does serve the file
correctly and it is Apache that appears to do something odd when Tomcat
returns a 304 response code.  

Apache Access Log

xx.xx.4.58 - - [17/Jul/2008:12:31:38 +0100] "GET /css/global.css HTTP/1.1"
304 -
xx.xx.4.58 - - [17/Jul/2008:12:31:42 +0100] "GET /css/global.css HTTP/1.1"
200 2352
xx.xx.4.58 - - [17/Jul/2008:12:31:48 +0100] "GET /css/global.css HTTP/1.1"
200 7323
xx.xx.4.58 - - [17/Jul/2008:12:31:51 +0100] "GET /css/global.css HTTP/1.1"
304 -
xx.xx.4.58 - - [17/Jul/2008:12:33:01 +0100] "GET /css/global.css HTTP/1.1"
200 7248
xx.xx.4.58 - - [17/Jul/2008:13:42:14 +0100] "GET /css/global.css HTTP/1.1"
200 7323

Tomcat Access Log

xx.xx.4.58 - - [17/Jul/2008:12:31:38 +0100] "GET /css/global.css HTTP/1.1"
304 -
xx.xx.4.58 - - [17/Jul/2008:12:31:42 +0100] "GET /css/global.css HTTP/1.1"
304 -
xx.xx.4.58 - - [17/Jul/2008:12:31:48 +0100] "GET /css/global.css HTTP/1.1"
200 7323
xx.xx.4.58 - - [17/Jul/2008:12:31:50 +0100] "GET /css/global.css HTTP/1.1"
304 -
xx.xx.4.58 - - [17/Jul/2008:12:33:01 +0100] "GET /css/global.css HTTP/1.1"
304 -
xx.xx.4.58 - - [17/Jul/2008:13:42:14 +0100] "GET /css/global.css HTTP/1.1"
200 7323

Little unsure about how the 4th request at 12:31:51 on Apache was served by
Tomcat at 12:31:50.  I've double checked this and it is correct.


Tim..




Tim Redding wrote:
> 
> 
> Thanks for the quick reply.  I've enabled the AccessLogValve.  I've just
> gotta wait for it to start playing up again.  Could be 2 hours or 2 weeks. 
> I'll reply when I have more info.
> 
> Tim.
> 
> 
> Len Popp wrote:
>> 
>> That log file is from the httpd server, right? What does the Tomcat
>> log file say? (Turn on AccessLogValve if you haven't already.) Is
>> Tomcat always getting requests for the correct file, or is mod_jk
>> requesting the wrong file sometimes?
>> -- 
>> Len
>> 
>> 
>> On Thu, Jul 10, 2008 at 11:44, Tim Redding <timr@tribalddb.co.uk> wrote:
>>>
>>> Hi,
>>>
>>> We are experiencing intermittent problems with a particular site that is
>>> not
>>> returning the correct file that is requested.  For instance if we
>>> request
>>> the index.html file we actually get a css file or even an image.  From
>>> the
>>> apache access log you can see that the size of the index.html file grows
>>> on
>>> the second request. This is because a gif was actually returned.
>>>
>>> XXX.XXX.XXX.130 - - [10/Jul/2008:15:10:39 +0100] "GET /index.html
>>> HTTP/1.1"
>>> 200 1068
>>> XXX.XXX.XXX.130 - - [10/Jul/2008:15:13:10 +0100] "GET /index.html
>>> HTTP/1.1"
>>> 200 9526
>>> XXX.XXX.XXX.130 - - [10/Jul/2008:15:13:48 +0100] "GET /index.html
>>> HTTP/1.1"
>>> 200 1086
>>>
>>> No error messages are logged in the mode_jk.log file.
>>>
>>> We have Apache/2.2.3 on the front on a Tomcat 6.0.16 server with mod_jk
>>> (version unknown but fairly recent).  We have all assets in our war
>>> file.
>>> When we hit Tomcat directly on port 8080 it serves the correct file. And
>>> to
>>> fix the problem an apache restart seems to sort things out.
>>>
>>> On this server with have 2 vhosts.  One is a simple nothing fancy static
>>> site and the other forwards everything to our Tomcat server.  Below I've
>>> included our mod_jk config and a snippet of our httpd.conf.
>>>
>>> Any ideas or things to try would be most appreciated.
>>>
>>>
>>> Tim.
>>>
>>>
>>>
>>> ============= mod_jk.conf ==========
>>>
>>> # Load mod_jk module
>>> # Specify the filename of the mod_jk lib
>>> LoadModule jk_module modules/mod_jk.so
>>>
>>> # Where to find workers.properties
>>> JkWorkersFile conf/workers.properties
>>>
>>> # Where to put jk logs
>>> JkLogFile logs/mod_jk.log
>>>
>>> # Set the jk log level [debug/error/info]
>>> JkLogLevel debug
>>>
>>> # Select the log format
>>> JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
>>>
>>> # JkOptions indicates to send SSK KEY SIZE
>>> JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
>>>
>>> # JkRequestLogFormat
>>> JkRequestLogFormat "%w %V %T"
>>>
>>> # Add shared memory.
>>> # This directive is present with 1.2.10 and
>>> # later versions of mod_jk, and is needed for
>>> # for load balancing to work properly
>>> JkShmFile logs/jk.shm
>>>
>>> # original URL pass through
>>> JkEnvVar    ORIGINAL_URI    w00t
>>>
>>> # Add jkstatus for managing runtime data
>>> <Location /jkstatus/>
>>> JkMount status
>>> Order deny,allow
>>> Deny from all
>>> Allow from 127.0.0.1
>>> </Location>
>>>
>>>
>>> ======= httpd.conf (our additions to the default file) ======
>>>
>>> # mod_jk include
>>> Include conf/mod_jk.conf
>>>
>>> <VirtualHost *:80>
>>>    DocumentRoot /var/www/html/
>>>    ServerName example.co.uk
>>>    ErrorLog logs/default-error.log
>>>    CustomLog logs/default-access.log common
>>>    alias /logs /var/widgets
>>>    <Location /logs>
>>>        AuthUserFile /var/widgets/.htpasswd
>>>        AuthName "Widgets"
>>>        AuthType Basic
>>>        Require valid-user
>>>    </Location>
>>>
>>>    Rewriteengine on
>>>    RewriteRule ^/$ /index.html [R]
>>>    jkmount /* loadbalancer
>>>    jkunmount /logs/*.gz loadbalancer
>>> </VirtualHost>
>>>
>>> <VirtualHost *:80>
>>>    DocumentRoot /var/www/html/
>>>    ServerName widgets.example.co.uk
>>>    ErrorLog /var/widgets/widget-error.log
>>>    CustomLog /var/widgets/widgets-access.log common
>>>    jkunmount /* loadbalancer
>>> </VirtualHost>
>>>
>>>
>>> ======= worker.properties ======
>>>
>>> worker.list=loadbalancer,status
>>> worker.node1.port=8009
>>> worker.node1.host=127.0.0.1
>>> worker.node1.type=ajp13
>>> worker.node1.lbfactor=1
>>> worker.loadbalancer.type=lb
>>> worker.loadbalancer.balance_workers=node1
>>> worker.status.type=status
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Apache-mod_jk-serves-random-files-from-tomcat-tp18385568p18385568.html
>>> Sent from the Tomcat - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>> 
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Apache-mod_jk-serves-random-files-from-tomcat-tp18385568p18511166.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Mime
View raw message