0 Replies Latest reply on May 16, 2011 6:18 AM by Adrie de Heer

    Extending web application's classpath

    Adrie de Heer Newbie

      Hi all,
            When trying to migrate our web application which currently runs on      Apache Geronimo to JBoss 6.0.0.Final I came across the following.
            Is there a way to add a custom directory to the web application's      classpath without changing the server configuration manually. In      our situation we have multiple web applications deployed to one      server each having their own properties file and other      configuration stuff
      (for some      reason this data is put outside the ear). In the application I want to read these files in an      application independent manner, i.e. without the need to know the      webapp's name. On Geronimo we use the 'classesDirs' property of      the SharedLib gbean in geronimo-application.xml to extend the      application's classpath with the specific webapp's configuration      directory.
            On JBoss I was thinking about the following configuration. Let's      say I have webapp1 and webapp2 each using a separate      config.properties file. I can put these files e.g. in the JBoss      conf directory as follows:
          If I could add the $JBOSS_HOME/server/<server-name>/conf/<webapp>    directory to the application's classpath the properties file can be    read by calling getResourceAsStream("/config.properties").
          Is there a proper way to achieve this?
            I know the $JBOSS_HOME/server/<server-name>/conf directory      is on the classpath by default so I can read the properties using   
      getResourceAsStream("/<webapp>/config.properties") but    that's not what I want.
            Thanks in advance.