Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001095 [Resin] major always 05-11-06 06:38 05-11-06 12:20
Reporter anonymous View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 3.0.18
Summary 0001095: Resin class loader doesn't find resources from jar
Description Our application loads Hibernate mapping files using Spring PathMatchingResourcePatternResolver class, with a pattern like "com/example/package/**/*.hbm.xml". The Spring pattern resolver then calls ClassLoader.getResources("com/example/package/") to first find all the resources under that location and then apply the given pattern **/*.hbm.xml in order to get only the mapping files.

When running as a standalone application (using the Sun class loader), the ClassLoader.getResources() call works as Spring expects. But when running under Resin, no resources are returned by the call.

The problem seems to be that if the resources are in a jar file in the classpath, com.caucho.loader.DynamicClassLoader.findResources() only accepts resource names that resolve to real files in the jar. Indeed when loading a single mapping file with ClassLoader.getResources("com/example/package/subpackage/Class.hbm.xml") there is no problem under Resin.

The classpath to the jar is defined resin.conf:
(the jar containing the mapping files is under ${APP_HOME}/lib)

-- snip --
<web-app-default>
      <class-loader>
        <tree-loader path="${server.rootDirectory}/ext-webapp"/>
        <library-loader path="${APP_HOME}/lib"/>
      </class-loader>
</web-app-default>
-- snip --

If the jar is appended to global CLASSPATH environment variable before starting the Resin, there is no problem. I guess that's because the resources are loaded using the default JVM system class loader in that case.
Additional Information
Attached Files

- Relationships

- Notes
(0001115)
ferg
05-11-06 12:20

server/249d
 

- Issue History
Date Modified Username Field Change
05-11-06 06:38 anonymous New Issue
05-11-06 12:20 ferg Note Added: 0001115
05-11-06 12:20 ferg Assigned To  => ferg
05-11-06 12:20 ferg Status new => closed
05-11-06 12:20 ferg Resolution open => fixed
05-11-06 12:20 ferg Fixed in Version  => 3.0.19


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker