1 Reply Latest reply on Apr 8, 2008 1:54 PM by Johannes Koch

    Deploying Non-Java Files with Application

    Johannes Koch Newbie

      My EJB3 application is configured by a Java .properties file. Running locally, it works fine. I can put the .properties file into the same directory as the class using it or in any other directory in the Eclipse project and provide the path to it as a String, like this:

       protected static Properties storedTypes = new Properties();
       public static void loadTypes() throws FileNotFoundException, IOException, ClassNotFoundException
       storedTypes.load(new FileInputStream("types.properties"));

      But when I deploy the application, I always get a FileNotFoundException. What I've tried so far:
      1. Putting the .properties file into the same directory as the class file (within the deployment jar file), using either only the file name as path or the path from the deployment directory (i.e. the package structure).
      2. Unzipping the jar file to a directory called MyApplication.jar and trying the steps above.
      3. Putting the .properties file into the conf directory, and using conf/xyz.properties as path.
      4. Putting the .properties file directly into the deploy directory and using only the filename as path.
      5. Creating a new directory in the deploy directory and putitng it in here.
      Nothing works, I keep getting a FileNotFoundException.
      I just can't imagine there is no way to use config files in a JBoss web application. Of course, I don't want to use absolute paths like C:/myConfigFiles.
      Does anyone know how to do this?