urlrewritefilter icon indicating copy to clipboard operation
urlrewritefilter copied to clipboard

bug: config loading uses System classload not current thread's classloader

Open GoogleCodeExporter opened this issue 10 years ago • 1 comments

What steps will reproduce the problem?
1. Place config file under /WEB-INF/classes/conf
2. Configure confPath in filter rule in web.xml as /conf/urlrewrite.xml
3.

What is the expected output?
The config file should load. It does not.

What do you see instead?
21:52:49.571 [ajp-bio-8009-exec-3] ERROR o.t.w.f.u.UrlRewriteFilter - unable to 
find urlrewrite conf file at /conf/urlrewrite.xml


What version of the product are you using? 
4.0.3

On what operating system?
Linux, Tomcat7

Please provide any additional information below.
The use of the System classloader in URLRewriteFilter:loadUrlRewriterLocal is 
incorrect.

The code at line 267 

        if ( inputStream == null ) {
            inputStream = ClassLoader.getSystemResourceAsStream(confPath);
        }

should use the current thread's classloader instead.

        if ( inputStream == null ) {
            inputStream = Thread.currentThread.getContextClassLoader().getResourceAsStream(confPath);
        }

This was previously reported (Issue #28) and closed. I believe this to be 
incorrect.

I have verified the failure of the system classloader by attempting to load my 
own resources using that instead of the current thread's classloader. 

Chris

Original issue reported on code.google.com by [email protected] on 10 Oct 2013 at 10:06

GoogleCodeExporter avatar Jul 05 '15 22:07 GoogleCodeExporter

Submitted a patch to 
https://code.google.com/p/urlrewritefilter/issues/detail?id=164 that fixes this 
issue in addition to another.

Original comment by [email protected] on 1 Jul 2014 at 3:20

GoogleCodeExporter avatar Jul 05 '15 22:07 GoogleCodeExporter