|Bundle classpath resources fail to load when using ServerOsgiBundleXmlWebApplicationContext [message #647363]
||Wed, 05 January 2011 19:08
| Martin Schmied
Registered: July 2009
I run into this problem when trying to deploy webapp based on spring-batch-admin-sample (available from git://github.com/SpringSource/spring-batch-admin.git). I removed many dependencies from the war and added appropriate imports, but I still wanted to keep all of the spring-batch-admin* bundles inside the war (on it's private classpath). Everything went fine until I changed the webapp's ApplicationContext class to ServerOsgiBundleXmlWebApplicationContext (in order to import some OSGi services). Suddenly, the application wasn't able to load some of the spring config files.
These configuration files are located in required libraries in WEB-INF/lib (and thus on bundle's private classpath), but ServerOsgiBundleXmlWebApplicationContext fails to locate them. It happens only when the resource pattern contains "absolute" path like classpath*:/org/springframework/batch/admin/web/resources/we bapp-config.xml. Changing the resource pattern to classpath*:org/springframework... fixes the problem. Unfortunaltely there are many places in spring-batch-admin with resource paths that cannot be resolved by ServerOsgiBundleXmlWebApplicationContext.
Solution might be as simple as removing leading slash from the path at some appropriate location within Spring-DM (maybe OsgiBundleResourcePatternResolver.findBundleClassPathMatchin gPaths).
Anyway, if you have some tip for a clean simple woraround, please respond. Otherwise this post might be just a piece of advice for others playing with Virgo & spring-batch.
Powered by FUDForum
. Page generated in 0.02409 seconds