0 Replies Latest reply on Feb 19, 2003 3:26 AM by Andrea Giovannini

    Problems with getResourceAsStream()

    Andrea Giovannini Newbie

      I'm trying to load a properties file in a class bundled with a EJB JAR file opening the input stream with

      InputStream is = MyClass.class.getClassLoader().getResourceAsStream("file.properties");

      Sometimes the file is not loaded so I looked around the web for another solution and I found

      InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("file.properties");

      as the preferred solution for properties loading in an EJB container.

      The problem not always happen so I'm looking for somebody who can confirm me this solution.

      Thanks in advance!