[jboss-user] [Beginner's Corner] - Extending web application's classpath

Adrie de Heer do-not-reply at jboss.com
Mon May 16 06:18:26 EDT 2011


Adrie de Heer [http://community.jboss.org/people/ahr] created the discussion

"Extending web application's classpath"

To view the discussion, visit: http://community.jboss.org/message/605420#605420

--------------------------------------------------------------
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:
    $JBOSS_HOME/server/<server-name>/conf/webapp1/config.properties
    $JBOSS_HOME/server/<server-name>/conf/webapp2/config.properties
    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.
      
      Regards,
      Adrie
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/605420#605420]

Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110516/15f41a15/attachment.html 


More information about the jboss-user mailing list