1

In my grails app, I use a third party library which makes heavy use of getClass().getClassLoader().getResource("/some/thing") - resource loading with absolute paths.

Resources are in grails-app/conf. Using grails run-app the classloader used is a org.codehaus.groovy.grails.cli.support.GrailsRootLoader. With this classloader, resolving fails when absolute paths are used. Resources do resolve without the preceeding "/" - e.g. some/thing does resolve. Resources also do resolve with the preceeding "/" in unit tests or when the app is packaged as a war. This both does not really help.

How do I get GrailsRootLoader to resolve absolute paths when I run the app with the grails command ?

PS: I use grails-2.0.3 on Linux and tried Java versions 1.7.0_01 (Oracle) and 1.6.0_24 (OpenJDK).

4

1 回答 1

0

我还没有尝试过,但看起来这应该在第三方库中修复:getResourceAsStream 在新环境下失败?

于 2012-05-05T20:05:34.630 回答