On Apr 16, 2008, at 7:42 AM, Xasima Xirohata wrote:

Hello, I have an EAR that expect to load a bunch of parameters from special 'property' folder (folder/performance-prop.property, folder/logging-prop.property and so on).
The resolving of these properties is done in the following manner
url = ClassLoader.getSystemResource ("relativePathToPropertyFile"); so classes just look into classpath for the relative path of certain property file, and the only I need is to put this property folder into classpath of the application server.

This seems to me to be a really strange way of exposing application specific data and I'm very surprised that any application server caters to this method. Why would you want to have to modify the classpath of the app server (not your app, the app server) in order to expose what is quite clearly application specific data? This seems extraordinarily non-modular to me.


When testing this EAR with WAS 6.1, I just set the path to this 'property' folder using VirtualMashine/Process Definition/ClassPath tab in WAS 6.1 administration console. When migrate to Geronimo 2.1 (bundled with jetty6, java 1.5 vm), I have experienced the following difficulties. I haven't found any way to add some data to classpath from Geronimo Administration Console, so I tried to set up this manually. I created the 'setenv.bat' in the %geronimo_home%/bin with the following content set GERONIMO_OPTS="-Djava.ext.dirs=C: \path2propertiesfolder1;C:\path2propertyfolder2" (actually I have several properties folder), but this didn't help so I have pass this options directly into the geronimo.bat where @REM Execute Java with the applicable properties

I've noticed that Administration Console (http://localhost:8080/ console/portal/Server/Java%20System%20Info) never lists the values that set up with such an approach. The file var/log/geronimo.log doesn't list them as well, although when a deploying occurs, this values appear into deployer.log. Thus it seems that geronimo_opts really is used only at deployment.

But no above efforts are sufficient to make this folder visible for my application.

I know that this is possible to set up classpath using eclipse plugin. We have tested this with WAS CE 1.x (server -> open -> edit- launch-configuration-properties -> user entries -> advanced -> add folder). I wonder what's the proper approach to set up the same with no eclipse assistance.

I guess the following ways to do this that probably may help, although haven't tried them yet 1) packed the PropertiesFolder as jar and place into %geronimo_home %/lib/endorsed 2) packed the folder as jar and write a deployment plan to install this into geronimo repository in the similar way as for common DB- Pool. After this we probably need to declare special dependency in regular EAR application / geronimo-application .xml onto group- artifact-resourcejar to list this as resource. 3) use some special way to deploy (install) application with custom classpath, and do this in local manner (just special options when deploy, or using some maven-plugins) not global .bat file rewritting.

I think that the last options is the best one. Assume the situation if someone has different application that are supposed to be configured with some properties files and these files are located in different places. It's too unnatural to move this data into application server lib or repository , since this is not suitable for user access and configuration.

Could someone please clear out the rules of classpath resolution?


As you can tell, I'm not in favor of allowing anyone to change the system classpath as a way to access application specific data. There's some documentation on what I at least consider appropriate ways of locating your app's configuration info:

http://cwiki.apache.org/GMOxDOC21/locating-your-application-specific- configuration-files.html

If you have further questions pleas ask!

thanks
david jencks

--
Best regards,
~ Xasima ~

Reply via email to