Passing jboss argument on startup
I'm trying to pass arguments to my jboss server on start up, its a string, but it always gets null when war is deployed here is how I do it:
./run.sh -Dfile.config=/home/stats/config.xml -c default -b 192.168.1.102
Strange this is that I don't this property passed to VM when looking at log :
[Se开发者_StackOverflow中文版rverInfo] VM arguments: -Dprogram.name=run.sh -Xms1303m -Xmx1303m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dsun.lang.ClassLoader.allowArraySyntax=true -Djava.net.preferIPv4Stack=true -Djava.endorsed.dirs=/apps/jboss/lib/endorsed
Can anyone figure out what I'm doing wrong? thank you
EDIT
This is how I reference this property in the code :
Properties property = System.getProperties();
String fileName = (String)property.get("file.config");
This works for me on windows, starting jboss from eclipse :
I'm trying to run this server from linux box this time.
You should put that into JAVA_OPTS
env variable:
$ export JAVA_OPTS="-Dfile.config=/home/stats/config.xml"
$ bin/run.sh
before starting JBoss or if this is not a one time option,
put that in bin/run.conf
in the JAVA_OPTS
expression there
I used environment variables. I set them before starting jboss, then collecting them inside my Class running on jboss.
精彩评论