title: How to load config.properties file in jboss-tomcat-struts when server starts
body: <p>I'm Java EE beginner. I'm trying to modify a system (jboss-3.2.3, tomcat-5.0.28, struts-1.1). I need to load a config.properties file when jboss/tomcat starts, so, the properties could be available for the entire application.</p>
  
  <p>This is what I was asked to do: "Load the .properties the first time (only one time) so, when it need to be readed is already in memory".</p>
  
  <p>How can I do that? Where can I start?</p>
  
  <p><strong>EDIT</strong>:
  I trying to load from properties-service.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;server&gt;
      &lt;mbean code="org.jboss.varia.property.PropertyEditorManagerService" name="jboss:type=Service,name=PropertyEditorManager"&gt;&lt;/mbean&gt;
  
      &lt;mbean code="org.jboss.varia.property.SystemPropertiesService" name="jboss:type=Service,name=SystemProperties"&gt;
          &lt;attribute name="URLList"&gt;
              ./conf/somelocal.properties
          &lt;/attribute&gt;
          &lt;attribute name="Properties"&gt;
              my.project.property=This is the value of my property
              my.project.anotherProperty=This is the value of my other property
          &lt;/attribute&gt;
      &lt;/mbean&gt;
  &lt;/server&gt;
  </code></pre>
  
  <p>Looks like JBOSS loads correctly:</p>
  
  <pre><code>2011-08-01 11:54:29,736 [INFO ] property.SystemPropertiesService - Loaded system properties from: file:/D:/jboss-3.2.3/server/default/conf/somelocal.properties
  2011-08-01 11:54:29,736 [INFO ] property.PropertyEditorManagerService - Started jboss:type=Service,name=PropertyEditorManager
  2011-08-01 11:54:29,736 [INFO ] property.SystemPropertiesService - Started jboss:type=Service,name=SystemProperties
  </code></pre>
  
  <p>But when I tried to use the property returns null:</p>
  
  <pre><code>String myProperty = System.getProperty("my.project.property");
  System.out.println(myProperty); // null
  </code></pre>
  
  <p>What could be wrong?</p>