Can JBoss 5 application access jars outside the EAR structure
When the jars are packaged within EAR/lib, all works fine, but I cannot use this approach and need to refer to t开发者_高级运维hem from the filesystem (maybe using absolute/relative paths) Also adding the jars to the system classpath (using conf/jboss-service.xml) is not an option.
I have already defined a scoped classloading using loader-repository for the app in jboss-app.xml
Is there a way the scoped classloader for the app can access libraries from outside the EAR structure?
Technically, yes, at least with JBoss 4.2, and with luck it'll work in 5 as well.
This takes advantage of the fact that when JBoss's EARDeployer
reads the path of each library in the application.xml
file, it resolves the path relative to the base directory of the exploded EAR. If you put in relative paths with the appropriate number of ../
entries, then the path will resolve to anywhere on the filesystem you like, as long as it's navigable as a path relative to where the EAR is deployed (i.e. on windows, it has to be on the same drive).
Be aware, though, this is not standard behaviour, and isn't even guaranteed to work between different versions of JBoss.
精彩评论