• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

setting user.dir system property in JBoss 5.1

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In JBoss 4.2.3 the System property 'user.dir' is defined to be

<JBoss-root>/bin



When I ran the same application on JBoss 5.1 I noticed that it cannot find the System property user.dir

why there is no default definition for version 5.1?
and how can I define it manually?
I followed this suggestion and added my property into properties-service.xml but it had no affect and still JBoss couldn't find the system:user.dir value.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That property will by default be set by the JVM when you launch Java. It points to the user's current working directory.

When I ran the same application on JBoss 5.1 I noticed that it cannot find the System property user.dir



How, when and where are you accessing that property?
 
Guy Roth
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to call the System property from my web application that is deploayed as a .war in <JBoss root>/server/default/deploy

by calling:
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can view all of the system properties in the jmx console (http://localhost:8080/jmx-console). Pick the jboss:type=Service,name=SystemProperties mbean, and the showAll operation.
 
Guy Roth
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. I opened the Mbean SystemProperties and couldn't find an operation to show all the properties such as suggested 'showAll'
I found only: addChild, getEventType, mejbStartRecursive, mejbStart, mejbStop, removeChild

2. even if I could view the list of existing properties my question is in addition how can I modify and add my own system parameters to JBoss (apart from adding them to the java execution command with -D)
 
Guy Roth
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually you are correct I did manage to perform System.getProperty("user.dir") and get the correct folder (bin)

however when I put in my web.xml the param:


and perform:


the returned value was user.dir/momo.ini
instead of bin/momo.ini

Why is that?
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


That's not how you are supposed to use it. The syntax is:



So when the xml is being parsed, JBoss will first look for a system property named "system-property-name" and if it's set then it will use that value. If it's not set then it will use the "default-value".

So you would want to change it to:

 
Guy Roth
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I works! Many thanks to you.


BTW, as far as I know the convention to use system param in web.xml using ${system:<param-name>} worked in JBoss 4.2.3.GA and stopped working only in JBoss 5.1, right?
 
reply
    Bookmark Topic Watch Topic
  • New Topic