4 Replies Latest reply on May 16, 2012 6:01 AM by grubi

    Classloader Problem [AS 7.1.1.Final]: 3rd-party libraries and getResource[AsStream]

    grubi

      Hi everybody,

       

      I just stumbled over a curious behaviour. I use the library hapax (java implementation of googles cTemplate) which uses the following line of code to find the path to an relative filename

       

      InputStream is = getClass().getClassLoader().getResourceAsStream(templatePath);

       

      The problem is, that the file can't be found because the path resolves to the module sun.jdk

       

      file:/D:/JBoss7/jboss-as-7.1.1.Final/modules/sun/jdk/main/service-loader-resources/

       

      Is this the normal behaviour? I would expect that the path resolves to the root of the web-application. Otherwise all third party libs are not able to get correct pathes...

      Currently I have to workaround it by creating my own implementation of the loader that overrides the call with ServiceContext#getRealPath().

       

      Thanks for your help!