4 Replies Latest reply on Feb 5, 2005 12:51 PM by John Leveille

    Properties

    sys user Master

      Hello,

      I use JBoss 4.0.0 and have some Property-Files which are used from my application. Now I don't know where to place the properties, so that JBoss finds them when booting.
      Is there a special folder to put .properties-Files?

      Thanks in advance

        • 1. Re: Properties
          Mat Allen Newbie

          Not sure if you mean for a client application to call a bean within jboss deployed app, such as a jndi.properties file or whether its for your application to gain access to a properties file programatically, such as getClassLoader().getResourceAsStream("??.properties"). but in either case, it just has to reside on the class-path.

          • 2. Re: Properties
            Ahsan Quadri Newbie

            Hi,
            Im also facing same problem, both on tomcat and Jboss. I also cannt load Properties file from Web archive WAR file.

            Please reply

            • 3. Re: Properties
              Ahsan Quadri Newbie

              Well, basically Im trying to load property file from my Java class, its not a Servlet but bundled within a WAR file. So I cannt use ServletContext.getResourceAsStream() and GetClass().getResourceAsStream either.

              Whenever im trying

              File file = new File("db.properties");
              Properties prop = new Properties();
              prop.load(file);

              Its saying FileNotFoundException, coz obviously its trying to loading from wrong path while this path is bundled with WAR.

              • 4. Re: Properties
                John Leveille Newbie

                Do you have experience loading properties froma file in JBoss 3.x? I have done that a lot and never had trouble. I am sorry to say that I don't have JBoss 4.0 experience so I cannot comment on any differences that arise from the version change.

                In 3.x we put properties files in the server/default/conf directory or inside the WAR file in WEB-INF/classes. Both of these locations load using getClass().getResourceAsStream() or by loading a resource bundle using the current class loader's methods.

                Is there a server/default/conf folder in JBoss 4? Have you tried WEB-INF/classes?