I am using JBoss 5 and the system properties service to set some system properties my app (ear with war) needs. One of these is the name of the virtual host which is referenced in jboss-web.xml:
<jboss-web>
<context-root>/</context-root>
<virtual-host>${my.host.system.prop}</virtual-host>
...
<depends>jboss:type=Service,name=SystemProperties</depends>
</jboss-web>
Note the dependency on the SystemProperties service.
However on server startup my app loads before the system properties have been set. Redeploying by touching the ear sorts it out. Interestingly I can see from the log that the SystemProperties service does indeed load before my app is deployed.
Anyone have any ideas? I don't want to resort to setting the props in JAVA_OPTS if I can help it.
Where do you your SystemProperties mbean defined? I had similar problem with JBoss 4.2 and my problem was solved by placing mbean definition into conf/jboss-service.xml instead of placing it into deploy directory. It cause that SystemProperties mbean is loaded in jboss startup.
Only disadvantage of this solution is that you loose hot deployment ability of SystemProperties mbean.