You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Leon Rosenberg <ro...@gmail.com> on 2012/11/07 09:58:47 UTC
Understanding RequestDispatcher
Hello,
I have a pretty weird behavior I don't understand in a customers
application. We have a drop-in monitoring webapp (moskito.anotheria.net)
which is installed by placing a jar into the target webapp and adding a
filter. This filter works pretty similar to struts 1.x, grab the url,
execute some code, make a forward to a jsp. It works in many applications.
However we encounter recently a problem with a clients installation, that
req.getForward goes back to the apache httpd in front of tomcat and in some
cases to the browser.
Here what usually happens:
Browser calls http://server/blub
in localhost_access logs I see the call to blub
0:0:0:0:0:0:0:1 - - [07/Nov/2012:09:45:32 +0100] "GET
/moskitodemo/mui/mskThresholds HTTP/1.1" 200 21398
The servlet makes an internal forward
(req.getRequestDispatcher(path_to_jsp).forward(req, res)).
I don't see this in localhost acces (neither do i expect to see it).
The jsp is executed the markup is returned to the client, everyone is happy.
Now what happens in _this_clients_ installation:
Browser calls http://server/blub
I see following in the access log
[1] 10.250.3.1 - - [07/Nov/2012:09:43:51 +0100] "GET
/net/java/dev/moskito/webui/jsp/Thresholds.jsp HTTP/1.1" 404 0 "-"
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML,
like Gecko) Chrome/23.0.1271.64 Safari/537.11"
[1] 10.250.3.1 - - [07/Nov/2012:09:43:51 +0100] "GET
/net/java/dev/moskito/webui/jsp/CSS.jsp HTTP/1.1" 200 0 "
http://app1.preprod.parship.office:8080/mui/mskThresholds" "Mozilla/5.0
(Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko)
Chrome/23.0.1271.64 Safari/537.11"
[1] 10.250.3.1 - - [07/Nov/2012:09:43:51 +0100] "GET /js/function.js
HTTP/1.1" 200 8667 "
http://app1.preprod.parship.office:8080/mui/mskThresholds" "Mozilla/5.0
(Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko)
Chrome/23.0.1271.64 Safari/537.11"
[1] 10.250.3.1 - - [07/Nov/2012:09:43:51 +0100] "GET /js/wz_tooltip.js
HTTP/1.1" 200 35082 "
http://app1.preprod.parship.office:8080/mui/mskThresholds" "Mozilla/5.0
(Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko)
Chrome/23.0.1271.64 Safari/537.11"
[1] 10.250.3.1 - - [07/Nov/2012:09:43:51 +0100] "GET
/js/jquery-1.8.0.min.js HTTP/1.1" 404 0 "
http://app1.preprod.parship.office:8080/mui/mskThresholds" "Mozilla/5.0
(Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko)
Chrome/23.0.1271.64 Safari/537.11"
[1] 10.250.3.1 - - [07/Nov/2012:09:43:51 +0100] "GET /favicon.ico HTTP/1.1"
404 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2)
AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11"
The weird thing is that I do see the internal forwards, but I don't see the
external calls in the logs.
There are a lot of strange things and history in the configuration of this
app, so I don't know where to start digging.
Any ideas what configuration can enforce such a behavior?
some data:
java 1.7.0-b147
tomcat 6.0.35
spring 3.1.0 (with a lot of interceptors)
connectors:
<Connector port="8009" protocol="AJP/1.3"
maxThreads="900"
redirectPort="8443"
emptySessionPath="true"
/>
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
emptySessionPath="true"
redirectPort="8443"
/>
thanx in advance
leon
Re: Understanding RequestDispatcher
Posted by Leon Rosenberg <ro...@gmail.com>.
Hello Konstantin,
On Wed, Nov 7, 2012 at 10:22 AM, Konstantin Kolinko
<kn...@gmail.com>wrote:
> 2012/11/7 Leon Rosenberg <ro...@gmail.com>:
> > Hello,
> >
> > I have a pretty weird behavior I don't understand in a customers
> > application. We have a drop-in monitoring webapp (moskito.anotheria.net)
> > which is installed by placing a jar into the target webapp and adding a
> > filter. This filter works pretty similar to struts 1.x, grab the url,
> > execute some code, make a forward to a jsp. It works in many
> applications.
> >
> > However we encounter recently a problem with a clients installation, that
> > req.getForward goes back to the apache httpd in front of tomcat and in
> some
> > cases to the browser.
> >
> > Here what usually happens:
> >
> > Browser calls http://server/blub
> > in localhost_access logs I see the call to blub
> > 0:0:0:0:0:0:0:1 - - [07/Nov/2012:09:45:32 +0100] "GET
> > /moskitodemo/mui/mskThresholds HTTP/1.1" 200 21398
> >
> > The servlet makes an internal forward
> > (req.getRequestDispatcher(path_to_jsp).forward(req, res)).
> > I don't see this in localhost acces (neither do i expect to see it).
> > The jsp is executed the markup is returned to the client, everyone is
> happy.
> > Now what happens in _this_clients_ installation:
> >
> > Browser calls http://server/blub
> > I see following in the access log
>
> Where this access log is configured?
>
Thank you for this excellent question.
It is indeed configured by application logback.xml and not server.xml :
<appender name="ACCESS_LOG"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/xxx/${INSTANCE}/logs/app/tomcat.access.log</file>
<rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>/xxx/${INSTANCE}/logs/app/tomcat.access.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
<maxHistory>${MAX_HISTORY}</maxHistory>
</rollingPolicy>
<encoder>
<pattern>[%X{instanceId}] %X{remoteAddr} - %X{remoteUser}
[%d{dd/MMM/yyyy:HH:mm:ss Z}] %X{requestUrl} %X{responseStatus}
%X{responseContentLength} "%X{requestReferer}"
"%X{requestUserAgent}"%n%xEx</pattern>
</encoder>
</appender>
<logger name="ACCESS_LOG" additivity="false">
<level value="INFO"/>
<appender-ref ref="ACCESS_LOG"/>
</logger>
This ACCESS_LOG is used by a Filter
which is referenced (and instantiated) by spring and not by web.xml
So right now I don't really understand what this filter is logging, because
it also adds a response wrapper and logs after the request has been
chained...
Thanks for your time.
regards
Leon
Re: Understanding RequestDispatcher
Posted by Konstantin Kolinko <kn...@gmail.com>.
2012/11/7 Leon Rosenberg <ro...@gmail.com>:
> Hello,
>
> I have a pretty weird behavior I don't understand in a customers
> application. We have a drop-in monitoring webapp (moskito.anotheria.net)
> which is installed by placing a jar into the target webapp and adding a
> filter. This filter works pretty similar to struts 1.x, grab the url,
> execute some code, make a forward to a jsp. It works in many applications.
>
> However we encounter recently a problem with a clients installation, that
> req.getForward goes back to the apache httpd in front of tomcat and in some
> cases to the browser.
>
> Here what usually happens:
>
> Browser calls http://server/blub
> in localhost_access logs I see the call to blub
> 0:0:0:0:0:0:0:1 - - [07/Nov/2012:09:45:32 +0100] "GET
> /moskitodemo/mui/mskThresholds HTTP/1.1" 200 21398
>
> The servlet makes an internal forward
> (req.getRequestDispatcher(path_to_jsp).forward(req, res)).
> I don't see this in localhost acces (neither do i expect to see it).
> The jsp is executed the markup is returned to the client, everyone is happy.
> Now what happens in _this_clients_ installation:
>
> Browser calls http://server/blub
> I see following in the access log
Where this access log is configured?
> [1] 10.250.3.1 - - [07/Nov/2012:09:43:51 +0100] "GET
> /net/java/dev/moskito/webui/jsp/Thresholds.jsp HTTP/1.1" 404 0 "-"
> "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML,
> like Gecko) Chrome/23.0.1271.64 Safari/537.11"
Why 404? Do you have this file?
> [1] 10.250.3.1 - - [07/Nov/2012:09:43:51 +0100] "GET
> /net/java/dev/moskito/webui/jsp/CSS.jsp HTTP/1.1" 200 0 "
> http://app1.preprod.parship.office:8080/mui/mskThresholds" "Mozilla/5.0
> (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko)
> Chrome/23.0.1271.64 Safari/537.11"
> [1] 10.250.3.1 - - [07/Nov/2012:09:43:51 +0100] "GET /js/function.js
> HTTP/1.1" 200 8667 "
> http://app1.preprod.parship.office:8080/mui/mskThresholds" "Mozilla/5.0
> (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko)
> Chrome/23.0.1271.64 Safari/537.11"
> [1] 10.250.3.1 - - [07/Nov/2012:09:43:51 +0100] "GET /js/wz_tooltip.js
> HTTP/1.1" 200 35082 "
> http://app1.preprod.parship.office:8080/mui/mskThresholds" "Mozilla/5.0
> (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko)
> Chrome/23.0.1271.64 Safari/537.11"
> [1] 10.250.3.1 - - [07/Nov/2012:09:43:51 +0100] "GET
> /js/jquery-1.8.0.min.js HTTP/1.1" 404 0 "
> http://app1.preprod.parship.office:8080/mui/mskThresholds" "Mozilla/5.0
> (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko)
> Chrome/23.0.1271.64 Safari/537.11"
Why 404?
> [1] 10.250.3.1 - - [07/Nov/2012:09:43:51 +0100] "GET /favicon.ico HTTP/1.1"
> 404 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2)
> AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11"
>
> The weird thing is that I do see the internal forwards, but I don't see the
> external calls in the logs.
What do you mean by "external calls"? Redirects (302, 307)? What did
you expect to see there?
> There are a lot of strange things and history in the configuration of this
> app, so I don't know where to start digging.
>
> Any ideas what configuration can enforce such a behavior?
>
> some data:
> java 1.7.0-b147
> tomcat 6.0.35
> spring 3.1.0 (with a lot of interceptors)
> connectors:
>
> <Connector port="8009" protocol="AJP/1.3"
> maxThreads="900"
> redirectPort="8443"
> emptySessionPath="true"
> />
> <Connector port="8080" protocol="HTTP/1.1"
> connectionTimeout="20000"
> emptySessionPath="true"
> redirectPort="8443"
> />
>
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org