[jboss-user] [JBoss Seam] - How to get Container properties

knuwu do-not-reply at jboss.com
Thu Mar 15 07:40:08 EDT 2007

I have the following problem:

I like to store some of my application configuration parameters outside the ear-package. The reason for that is, that some configuration values will have different values for development, test and production enviroment.

Best would be to store these values in a configuration file in the config directory of the container (equally to *-ds.xml configuration).

First difficulty: Find out where the container is running and where to find the config directory.

Second difficulty: If there are more than one application running on the same container, you have to chose a unique file name for your config file for each application running on that container. So the application must know it's name.

Third difficulty: All above should even work, when you are testing your application with testng and you are running in an embedded ejb3 container.

I found a solution for the first two problems. I get the deployment path from the Deploy Scanner MBean and calculate the path of the server config relative to that path. I derive the application name from the Init.instance().getJndiPattern() value.

You may also get the path information from System.getProperty calls.

But all is not working, if you start testing with the embedded ejb3 conatiner.  The embedded ejb container does neither have the appropriate MBeans nor are there system properties.

The only solution might be to set a special system property. Disadvantage of that solution: You have to make sure it will be set in all possible run configurations (testng plugin, testng ant call, jboss start with eclipse plugin, jboss start with command line).

Is there a better solution?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4028322#4028322

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4028322

More information about the jboss-user mailing list