tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: specifying the content-type
Date Wed, 01 Jun 2011 10:04:33 GMT
Lentes, Bernd wrote:
> Charles Caldarale wrote:
> 
>>> when talking with a web browser directly to tomcat (port 8080), the
>>> web page is shown correctly.
>> Are you sure the original request on port 80 is actually
>> making it through httpd all the way to Tomcat?  The symptoms
>> you're reporting are characteristic of a misconfigured httpd
>> not forwarding anything to Tomcat.  Post your mod_jk config
>> for someone (probably not me) to look at.
>>
> 
> Currently i'm logging the whole AJP-stuff between httpd and tomcat (that's a lot). This
shows that httpd forwards the request to tomcat, and tomcat delivers the response.
> 

Your configuration of mod_jk below looks correct (except a small detail, see JkMount).
But I must say that it is difficult to believe that the request is actually forwarded to 
Tomcat, and that Tomcat then fails to recognise the file as a JSP page, and returns it as

"text/plain" source.
Particularly if, as you said earlier, when you access the same URL on Tomcat directly, via

port 8080, the same document displays correctly.

The <Connector>'s in Tomcat (the one for HTTP port 8080, and the one for AJP on port
8009) 
are just interfaces that receive a request in some format, translate it to a common 
internal format, and then forward it in that internal format to the internal Tomcat 
machinery (which is the same in both cases).  So whether a request is originally received

on the HTTP Connector or on the AJP Connector, should not make a difference in terms of 
how Tomcat processes the same URL.  And the result should be returned the same way in both

cases.

So something in the symptoms you report does not fit.

Can you :
- stop Apache
- clear the mod_jk log
- restart Apache
- then issue just one request to "mouseidgenes" through Apache (port 80)
- then edit the mod_jk log, find the lines specific to that one request,
and paste them here

To explain :
when a module like mod_jk is installed in Apache, then Apache will forward *every* request

to mod_jk.  It is mod_jk which then examines the URL, and decides if it wants to handle 
this request or not.
If not, it returns a code to Apache saying "I decline the request", and then Apache looks

for another response handler to handle this.(*)
If mod_jk decides to handle the request (because it matches one of the URLs that it has 
been asked to handle, via the JkMount directives), /then/ it forwards it to Tomcat, waits

for the Tomcat response, and returns this response to Apache (which returns it to the 
browser).

(*) Apache does the same for any other "handlers" that have been installed.  Each of them

is called in turn with the same URL.  The first one who decides to handle the request wins.
If no handlers decide to process this request (and all return "declined"), then eventually

Apache will process the request with its own default handler.  That one finds the 
requested file on disk somwhere under the Apache DocumentRoot, and returns it to the 
browser with a Content-type that is what the default Apache handler thinks it is.
(in this case, plain text).

So what I suspect, is that when you look at the mod_jk log, you see lines that show that 
indeed mod_jk received the request URL from Apache, and is trying to match it to one of 
its internally mapped URLs.
But you may be missing the line that says, in the end, that mod_jk could not match the 
URL, and is returning a response "declined" to Apache.


> My mod_jk.conf:
> 
>     # Load mod_jk module
>     # LoadModule    jk_module  libexec/mod_jk.so
> 
>     # Declare the module for <IfModule directive> (remove this line on Apache 2.0.x)
>     # AddModule     mod_jk.c
> 
>     # Where to find workers.properties
>     # JkWorkersFile /etc/httpd/conf/workers.properties
> 
>     # Where to put jk shared memory
>     JkShmFile     /var/log/apache2/mod_jk.shm
> 
>     # Where to put jk logs
>     JkLogFile     /var/log/apache2/mod_jk.log
> 
>     # Set the jk log level [debug/error/info]
>     JkLogLevel    debug
> 
>     # Select the timestamp log format
>     JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
> 
>     JkRequestLogFormat     "%r %s %w %V"
> 
>     JKWorkerProperty worker.appl01.type=ajp13
>     JKWorkerProperty worker.appl01.host=localhost
>     JKWorkerProperty worker.appl01.port=8009
>     JKWorkerProperty worker.list=appl01
> 
>     # Send servlet for context /mouseidgenes to worker named appl01
>     JkMount  /mouseidgenes/* appl01

This will forward a request like "/mouseidgenes/index.jsp", but will not
forward the URL "/mouseidgenes". You may want to add
      JkMount  /mouseidgenes appl01


> 
>     # Send JSPs  for context /examples to worker named worker1
>     # JkMount  /examples/*.jsp worker1
> 
> 
> Bernd
> 
> Helmholtz Zentrum München
> Deutsches Forschungszentrum für Gesundheit und Umwelt (GmbH)
> Ingolstädter Landstr. 1
> 85764 Neuherberg
> www.helmholtz-muenchen.de
> Aufsichtsratsvorsitzende: MinDir´in Bärbel Brumme-Bothe
> Geschäftsführer: Prof. Dr. Günther Wess und Dr. Nikolaus Blum
> Registergericht: Amtsgericht München HRB 6466
> USt-IdNr: DE 129521671


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


Mime
View raw message