Some third-party libraries rely on files placed under META-INF in "the classpath" for configuration -- Jersey and Hibernate, for example. However, "the classpath" in an OSGi context does not exist any more in its "classic" (pre-OSGi) acceptance.
With Jersey, copying the files under my own bundle proved to be a usable workaround and Jersey manages to load those files properly. However, Hibernate (more exactly, org.hibernate.ejb.Ejb3Configuration) follows a different strategy: it asks the current thread's context classloader what the URL to the resource is, then it attempts to read from that URL itself. Although I'm setting the current thread's context class loader to be my bundle's classloader (in a static block at the top of my bundle activator), Ejb3Configuration fails to read that file when running in Felix, because the URL returned by the classloader is something like "bundle://...", which it does not know how to process. Is there a "Felix-recommended" (or perhaps better, OSGi-recommended) way of placing those "META-INF" resources? (I cannot wait until all third-party bundles become OSGi-friendly, sorry.) The only thing I could think of was to set the current thread's context class loader not directly to my bundle's (Felix) class loader, but to a custom one that I write, and that for a certain (configurable) set of resources it returns "file://..." URLs to a custom directory within the container, and for everything else it defers to the Felix class loader. Any better idea would be appreciated. -- View this message in context: http://www.nabble.com/Third-party-libraries-cannot-access-META-INF-filename-resources-tp23431881p23431881.html Sent from the Apache Felix - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

