1 Reply Latest reply on Sep 28, 2010 8:59 AM by jaikiran pai

    reading application startup files in JBoss 4 vs 5

    Nilesh Thali Newbie


      We have a slightly modified configuration for our app, that worked in JBoss 4.0.0, but doesn't in JBoss 5.1.0.

      We copied the "web" configuration (under JBoss5.1.0/server/web) to create our own setup.

      our war file contains a web.xml that specifies a servlet and a properties file that's a parameter for the servlet at startup.

      This properties file is at the top level of our JBoss instance.


      we have


      |-- myServer.properties

      |-- deploy

            |-- myWar.war


      myWar.war has a web.xml containing the following snippet:




      JBoss 4.0.0 had no problems finding the myServer.properties file located in myConfiguration, but JBoss 5.1.0.GA throws a "FileNotFoundException".


      Any ideas on what we need to change to get it to work?


      I guess the second question would be - what are other (better) ways of doing this?




        • 1. Re: reading application startup files in JBoss 4 vs 5
          jaikiran pai Master

          Please post the entire exception stacktrace? And how exactly are you reading that file? Using java.io.File? Instead for JavaEE applications, it's better to use the following code:


          String startupFileName=...// get the file name from ENC
          InputStream is = this.getClass().getClassLoader().getResourceAsStream(startupFileName);



          The resource will then be looked within the classpath of the application. So you can either package that myserver.properties within your app or place it in JBOSS_HOME/server/servername/conf folder (which by default is available in classpath).