London
London

Reputation: 15274

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 :

[ServerInfo] 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 :

enter image description here

I'm trying to run this server from linux box this time.

Upvotes: 2

Views: 16406

Answers (2)

London
London

Reputation: 15274

I used environment variables. I set them before starting jboss, then collecting them inside my Class running on jboss.

Upvotes: 2

Heiko Rupp
Heiko Rupp

Reputation: 30934

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

Upvotes: 2

Related Questions