3 Replies Latest reply: Jun 12, 2012 10:01 AM by Ravi Jegga RSS

    Reading proprties file directly under WEB-INF folder


      We have ADF fusion web application, which is being deployed as ear in a standalone web-logic server.
      The application have several projects, which are bundled as a jar inside the ear, on only one top level project is used to create WAR

      The WEB-INF folder of this war contains a properties file.

      Now from one of the project which is bundled as jar , i want to read the properties file, but i am not able to get it.

      I have already tried using - this.getClass().getClassLoader().getResourceAsStream("/WEB-INF/some.properties"); but this doesn't work.

      The fact is that i cant place this file under WEB-INF/classes folder because there is none, also i want to read it directlu under WEB-INF folder

      Is there any way by which i can access this file??

        • 1. Re: Reading proprties file directly under WEB-INF folder
          Ravi Jegga
          Hi Ankit
          First you have to set a flag in your admin console. Login into Weblogic Admin Console. On left side, in Domain Structure Window, click on the parent node which is your Domain name. Click on this. On right side, click on the Tab named "Web Applications". Scroll all the way down and check the box named like "Archive Real Path Enabled". Save and you have to restart the Server. Read the notes about this flag there. Now you should be able to read any .properties file from your WAR fiile.

          Ravi Jegga
          • 2. Re: Reading proprties file directly under WEB-INF folder
            HI Ravi , it was nice advice , can u pls let me know how to solve this problem in weblogic 9.2 server.

            that would be really appriciated.

            Thanks a lot
            • 3. Re: Reading proprties file directly under WEB-INF folder
              Ravi Jegga
              Hi Peter
              I do NOT have WLS 9.x installed on my local machine. But I am wondering even WLS 9.x should have this Flag. Can you please login into weblogic console and see if this flag is there and apply the solution that I mentioned earlier. It should be there most probably.

              If you are facing some other problem, I would prefer open a new thread and post your issue/problem there.

              Ravi Jegga