I have a properties file that I would like to place at the JBoss instance level
to provide some properties to my applications (to make them aware of the
environment they are running in).

I tried to place my .properties file in <instance>/lib, but I've noticed that the
ClassLoader will not find the properties.

Is there a preferred way in which to load properties that will allow me to have
different properties at the instance level?  (I am running 5 different instances
out of the same JBoss home directory.)

The code I am using to load the properties is as follows:

                        String name = "environment.properties";
                        InputStream is = null;
                        instance = new EnvironmentProperties();
                        ClassLoader classLoader =
Thread.currentThread().getContextClassLoader();
        
                        is = classLoader.getResourceAsStream(name);
                        if (is != null)
                        {
                                try
                                {
                                        instance.load(is);
                                }
                                catch (IOException e)
                                {
                                        System.err.println("IOException on load:
" + e);
                                }
                                finally
                                {
                                        try
                                        {
                                                is.close();
                                        }
                                        catch (IOException e)
                                        {
                                                System.err.println("IOException
on close: " + e);
                                        }
                                }

I've seen the properties-service.xml, but I'm trying to do this in a manner that
is portable across containers.

Troy



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to