<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Extending web application's classpath
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/ahr">Adrie de Heer</a> in <i>Beginner's Corner</i> - <a href="http://community.jboss.org/message/605420#605420">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p class="moz-text-html" lang="x-western"><span style="font-family: Luxi Sans;">Hi all,<br/>      <br/>      When trying to migrate our web application which currently runs on      Apache Geronimo to JBoss 6.0.0.Final I came across the following.<br/>      <br/>      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 </span><span style="font-family: Luxi Sans;">(for some      reason this data is put outside the ear)</span><span style="font-family: Luxi Sans;">. 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.<br/>      <br/>      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:<br/>    </span><span style="font-family: Luxi Sans;">$JBOSS_HOME/server/<server-name>/conf</span>/webapp1/config.properties<br/>    <span style="font-family: Luxi Sans;">$JBOSS_HOME/server/<server-name>/conf</span>/webapp2/config.properties<br/>    <span style="font-family: Luxi Sans;">If I could add the </span> <span style="font-family: Luxi Sans;">$JBOSS_HOME/server/<server-name>/conf</span>/<webapp>    directory to the application's classpath the properties file can be    read by calling getResourceAsStream("/config.properties").<br/>    <span style="font-family: Luxi Sans;">Is there a proper way to achieve this?<br/>      <br/>      I know the $JBOSS_HOME/server/<server-name>/conf directory      is on the classpath by default so I can read the properties using    </span>getResourceAsStream("/<webapp>/config.properties") but    that's not what I want.<span style="font-family: Luxi Sans;"><br/>      <br/>      Thanks in advance.<br/>      <br/>      Regards,<br/>      Adrie</span></p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/605420#605420">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Beginner's Corner at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>