1 Reply Latest reply on Aug 13, 2002 12:40 PM by sgturner

    Path for Property files in EAR deployments


      A customary way to get access to a property file on disk within a WAR deployment is to use for example the code snippet:


      where application is the well known jsp member variable for the ServletContext. The application.getResourceAsStream() points to the root of the WAR deployment.

      I would like to nest several WAR files within one EAR deployment and have the EAR deployment contain the properties because they are common to all WARs in our environment. Does anyone know how to get a resourceStream pointing to the root of the EAR ? I am not intereseted in the a path for EJBs (some web apps don't use EJBs), I just want an EAR path.


        • 1. Re: Path for Property files in EAR deployments

          This is not what you are asking for, but here is how I do it. In my code, a single property file is specific to a Class. So, I put every property file in exactly the same place as the *.class file it is associated with. Then in the code, I use getClass().getResourceAsStream.

          An alternative method is to create an MBean to manage all the property files.