This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I know it's possible to define <env-entry> elements in web.xml for environment properties of a web application. But how do you access <env-entry> elements from classes that do not exist within a web application? In other words, this is my problem: I have an EAR file, enterprise.ear, which contains the following... employee.jar employeeSearchEJB.jar webApp1.war META-INF/ application.xml The employee.jar file is a utility archive that contains common classes, one of which is a class called LogManager. LogManager needs to read environment properties in order to initialize itself. Currently, LogManager reads these properties from a property file, and therefore it needs to know the name of the property file in order to access it. I dont like this approach because I'm forced to hard-code the name of the property file in LogManager. I would rather leverage the power of J2EE deployment descriptors and use the <env-entry> element to define the environment properties for the LogManager class. Then, I would simply use JNDI to get the values of the <env-entry> elements without ever having to specify their location aside from the default JNDI context; java:comp/env, which is standard anyway. The problem I'm having is that you can define the <env-entry> element in only 2 types of deployment descriptors; namely, web.xml and ejb-jar.xml, neither of which are available to LogManager because LogManager exists at the EAR root level. I was hoping application.xml supported the <env-entry> element, but it doesn't. Any suggestions? SAF [ March 01, 2002: Message edited by: SAFROLE YUTANI ]