You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by jo...@thomsonreuters.com on 2010/07/26 16:24:16 UTC

URLRewrite filter loading twice..Not finding context second time

I have configured the URLRewrite filter for the default web application
"ROOT". I just placed the jar in the WEB-INF\lib location and the
configuration file in WEB-INF. The filter seems to load once, find my
context that I would like to map to then load a second time only NOT
finding the context the second time. Any idea what Tomcat is doing?

 

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.utils.Log DEBUG: logLevel set to
TRACE

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter DEBUG: confPath
set to /WEB-INF/urlrewrite.xml

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: XML builder factory
is: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: XML Parser:
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: about to parse conf

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.ConfHandler DEBUG: Resolving to
DTD /org/tuckey/web/filters/urlrewrite/dtds/urlrewrite3.2.dtd

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: now initialising
conf

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: loaded rule Rule
0 (/test/status/, %{context-path}/rewrite-status 0)

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.NormalRule DEBUG: loaded rule
Rule 0 (/test/status/, %{context-path}/rewrite-status 0)

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: rule match type
is wildcard

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: loaded rule Rule
1 (/NASApp/DealSearch/**, /DealsWeb/$1 1)

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.NormalRule DEBUG: loaded rule
Rule 1 (/NASApp/DealSearch/**, /DealsWeb/$1 1)

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.NormalRule DEBUG: looking for
context DealsWeb

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.NormalRule DEBUG: got context ok

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: loaded rule null

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.OutboundRule DEBUG: loaded
outbound rule Outbound Rule 0 (/rewrite-status, /test/status/)

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: conf status true

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter DEBUG: inited
with 2 rules

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter DEBUG: conf is
ok

Jul 26, 2010 10:13:33 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: loaded
(conf ok)

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.utils.Log DEBUG: logLevel set to
TRACE

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter DEBUG: confPath
set to /WEB-INF/urlrewrite.xml

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: XML builder factory
is: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: XML Parser:
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: about to parse conf

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.ConfHandler DEBUG: Resolving to
DTD /org/tuckey/web/filters/urlrewrite/dtds/urlrewrite3.2.dtd

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: now initialising
conf

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: loaded rule Rule
0 (/test/status/, %{context-path}/rewrite-status 0)

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.NormalRule DEBUG: loaded rule
Rule 0 (/test/status/, %{context-path}/rewrite-status 0)

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: rule match type
is wildcard

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: loaded rule Rule
1 (/NASApp/DealSearch/**, /DealsWeb/$1 1)

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.NormalRule DEBUG: loaded rule
Rule 1 (/NASApp/DealSearch/**, /DealsWeb/$1 1)

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.NormalRule DEBUG: looking for
context DealsWeb

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.NormalRule ERROR: Rule Rule 1
had error: could not get servlet context DealsWeb

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.RuleBase ERROR: could not get
servlet context DealsWeb

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: loaded rule null

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.OutboundRule DEBUG: loaded
outbound rule Outbound Rule 0 (/rewrite-status, /test/status/)

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: conf status false

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter DEBUG: inited
with 2 rules

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter DEBUG: conf is
NOT ok

Jul 26, 2010 10:13:41 AM org.apache.catalina.core.ApplicationContext log

INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter ERROR: Conf
failed to load


RE: URLRewrite filter loading twice..Not finding context second time

Posted by jo...@thomsonreuters.com.
Yea sorry about that. I did get it to work just. I just created my own
root web app. Not sure what the issue with ROOT was.

-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Sent: Monday, July 26, 2010 10:38 AM
To: Tomcat Users List
Subject: RE: URLRewrite filter loading twice..Not finding context second
time

> From: john.ranaudo@thomsonreuters.com
> [mailto:john.ranaudo@thomsonreuters.com]
> Subject: URLRewrite filter loading twice..Not finding context second 
> time
> 
> Any idea what Tomcat is doing?

It's doing whatever it's been told.  Unfortunately, you haven't told
*us* much.

Tomcat version?  JVM version?  Platform?  Contents of
ROOT/WEB-INF/web.xml?  Contents of ROOT/WEB-INF/urlrewrite.xml?  URLs
you're trying?

You should also enable the access log and see what's actually coming
into 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.


---------------------------------------------------------------------
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: URLRewrite filter loading twice..Not finding context second time

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: john.ranaudo@thomsonreuters.com
> [mailto:john.ranaudo@thomsonreuters.com]
> Subject: RE: URLRewrite filter loading twice..Not finding context
> second time
> 
> The above works when running in a separate web application from ROOT.

I didn't see anything obviously wrong.

> I removed the "ROOT" application and added my own custom root 
> application called URLRewrite with the same configuration.

You can't have a webapp with two names (ROOT *and* URLRewrite), so something's wrong there.

> Only difference is the addition of the context element 
> in server.xml.

Red flags go up - <Context> elements should not be placed in server.xml.  The ability to do so is a hold-over from previous versions of Tomcat.  The <Context> element should be in webapps/ROOT/META-INF/context.xml or conf/Catalina/[host]/ROOT.xml and must not contain a path attribute.  The second alternative only should contain a docBase attribute if the webapp is deployed somewhere other than the <Host> appBase directory.

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


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


RE: URLRewrite filter loading twice..Not finding context second time

Posted by jo...@thomsonreuters.com.
In hindsight, let me post the details anyway. Tomcat 6.0.26 using JVM
1.6_20 on Windows.

I am trying to map http://localhost/NASApp/DealSearch/RequestServlet to
http://localhost/DealsWeb/RequestServlet

<<<<< ROOT Web.xml >>>>>>>>>>>>>>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"   version="2.5">

	<display-name>Welcome</display-name>
	<description>Welcome</description>
	<filter>
		<filter-name>UrlRewriteFilter</filter-name>
	
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter
-class>
		<init-param>
            <param-name>logLevel</param-name>
            <param-value>TRACE</param-value>
        </init-param>
	</filter>
	<filter-mapping>
		<filter-name>UrlRewriteFilter</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>FORWARD</dispatcher>
	</filter-mapping>	

</web-app>

<<<<< urlrewrite.xml >>>>>>>>>>>>>>
<urlrewrite>

    <rule>
        <from>/test/status/</from>
        <to type="redirect">%{context-path}/rewrite-status</to>
    </rule>

    <outbound-rule>
        <from>/rewrite-status</from>
        <to>/test/status/</to>
    </outbound-rule>

	<rule match-type="wildcard">
	   <from>/NASApp/DealSearch/**</from>
	   <to context="DealsWeb">/$1</to>
	</rule>
</urlrewrite>

The above works when running in a separate web application from ROOT. I
removed the "ROOT" application and added my own custom root application
called URLRewrite with the same configuration. Only difference is the
addition of the context element in server.xml.

Thanks.



-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Sent: Monday, July 26, 2010 10:38 AM
To: Tomcat Users List
Subject: RE: URLRewrite filter loading twice..Not finding context second
time

> From: john.ranaudo@thomsonreuters.com
> [mailto:john.ranaudo@thomsonreuters.com]
> Subject: URLRewrite filter loading twice..Not finding context second 
> time
> 
> Any idea what Tomcat is doing?

It's doing whatever it's been told.  Unfortunately, you haven't told
*us* much.

Tomcat version?  JVM version?  Platform?  Contents of
ROOT/WEB-INF/web.xml?  Contents of ROOT/WEB-INF/urlrewrite.xml?  URLs
you're trying?

You should also enable the access log and see what's actually coming
into 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.


---------------------------------------------------------------------
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: URLRewrite filter loading twice..Not finding context second time

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: john.ranaudo@thomsonreuters.com
> [mailto:john.ranaudo@thomsonreuters.com]
> Subject: URLRewrite filter loading twice..Not finding context second
> time
> 
> Any idea what Tomcat is doing?

It's doing whatever it's been told.  Unfortunately, you haven't told *us* much.

Tomcat version?  JVM version?  Platform?  Contents of ROOT/WEB-INF/web.xml?  Contents of ROOT/WEB-INF/urlrewrite.xml?  URLs you're trying?

You should also enable the access log and see what's actually coming into 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.


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