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: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to