users@glassfish.java.net

Re: Class-path issues on glassfish

From: <glassfish_at_javadesktop.org>
Date: Sat, 10 May 2008 06:52:27 PDT

I think the approach suggested by asherwin is probably the best. But you could also use the application class-loader or the common class-loader.

Now your problem with /configuration/config.xml is caused by using "optional packages" (http://java.sun.com/j2se/1.5.0/docs/guide/extensions/extensions.html). Thus your class XmlElement is loaded very high up in the classloader chain and your config-file would have to be in a place where the Bootstrap- or the System-classloader (I am not entirely sure which one of these two) could find it.

[b]I seriously doubt that your external library really belongs in the ext-folder.[/b] This library is either domain-specific or web-app specific in which case you should put them under WEB-INF/lib.

If you do the latter, your config file could be placed at WEB-INF/classes/configuration/config.xml like you've already tried.

If you do the former you put the jar file into the domains/domain1/lib-folder and your configuration-file into domains/domain1/lib/classes - of course in your case you must put it into a configuration-subdir.

And finally if you use the application classloader you can put these jars into domains/domain1/lib/applibs and the configuration file in the respective WEB-INF/classes directories (or create a jar containing you properties and put it also into applibs).
[Message sent by forum member 'writtmeyer' (writtmeyer)]

http://forums.java.net/jive/thread.jspa?messageID=273648