Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

Plow United

Greenhorn
+ Follow
since Jan 07, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Plow United

Hi everyone! I would like to use Apache Common Configurations to determine my apps current environment (dev, test, production sort of thing). Everything has been super smooth so far except getting JNDI to work. I was thinking of using JNDI to determine the server environment, say something like java:comp/env/target.env and that look-up would return a string, either like "dev", "test" - something like that.

When I debug, I can see my JNDI stuff being loaded in the CompositeConfiguration but I cant seem to get the property to be returned. To elaborate, under the debugger, I can see that there is a JNDI config and I can see my jndi binding in the list of binding, but that config is not being added to the combined list? I have tryed getKeys(); getProperty and the like. I have also tried using both the config.xml file and add jndi to the list and I have tried adding each config separately using addConfiguration.

Is there a trick I am missing? Any help is much appreciated. I guess I could also set a system variable and get the same results - would that be a more portable solution? In my situation, I am using the Maven Jetty plugin to provide a quick a server but the application is deployed to Tomcat servers once they leave my local development environment.

Thanks in advance for any help!!