views:

576

answers:

1

When the jars are packaged within EAR/lib, all works fine, but I cannot use this approach and need to refer to them 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?

+1  A: 

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.

skaffman
Thanks, but this didn't seem to work. As long as the relative paths are within the EAR structure it works. But fails when the paths lead to external jars.
Shreeni
Can you add the contents of your `application.xml` to the question?
skaffman
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd"><application id="Application_ID"> <display-name>FindingNemoEar</display-name> <module id="WebModule_1158763557391"> <web> <web-uri>FindingNemoEarWeb.war</web-uri> <context-root>FindingNemo</context-root> </web> </module> <module> <java>../../abc.jar</java> </module></application>
Shreeni