tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 39794] New: - getResource method of WebappClassLoader does not return URLs for packages
Date Tue, 13 Jun 2006 06:38:50 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39794>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39794

           Summary: getResource method of WebappClassLoader does not return
                    URLs for packages
           Product: Tomcat 5
           Version: 5.0.30
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: mjesseni@edu.uni-klu.ac.at


In my application scenario I need to be able to find all resources located 
within a given package. Therefore, I use the getResource method to find first 
the package along the classpath and afterwards I list all resources located 
within this package. I need this functionality to find all available Hibernate 
mapping documents so that I can dynamically configure Hibernate and dont need 
to know exact names of mapping documents. However, the WebappClassLoader does 
not return URLs for packages. For example

Thread.currentThread().getContextClassLoader().getResource("path/to/package");

returns null. The workaround for this issue is to place a resource with a 
fixed name in this package, so that this resource can be found. From the 
returned URL I extract the directory and than list the resources within that 
directory. 

However, the getResource method of the JVM classloader implementation also 
returns URLs for packages so that this workaround is not needed I 'normal' 
java applications. I am not sure whether or not this is a bug of the webapp 
classloader implementation.

I use tomcat 5.0.30 and Java 1.5.0_07.

Kind regards
Markus jessenitschnig

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message