Applying system properties inside Glassfish

If you’re building an Enterprise Java Bean, a web application or some kind of component that uses references to different (for instance) web service URL’s, then system variables come in handy. These situations can particularly appear inside DTAP environments.

Inside the Glassfish admin console open the configurations node. Depending on if you’re using a cluster configuration or not, you’ll see a couple of nodes like server-config, xxx-cluster-config, and so on. If you’re building software that is running on the xxx-cluster, you have to open the xxx-cluster-config and go to the “System properties” page.

You can do “Add Property” and fill

  • Instance Variable Name : your.webservice.url
  • Default Value : http://development.your.webservice/hello?WSDL

Inside the admin console of the test, acceptance and production you can do the same, but then with different URL’s.

Inside Java it is very simple to get the value of the system property.

String webserviceURL = System.getProperty("your.webservice.url") ;

It keeps your code cleaner, and free it from all kinds of system value strings spread all over your application(s). Don’t forget to make an installation documentation for maintenance purposes. Thes kind of system configurations can easily be forgotton. Especially when you’re dealing with many web component systems.

Comments are closed.

Algemeen (8)
GlassFish (43)
Java (56)
Managed Services (9)
Oracle (88)
Private Cloud Hosting (2)
SOA/BPEL/ESB (6)
Software development (40)
Strategie (6)
WSO2 (2)

WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.

  • 071 - 82 000 82
  • Rijndijk 137 | 2394 AG Hazerswoude-Rijndijk
Oracle SOA specialized partner
Java
GlassFish
WSO2
DEMO
i-bridge
Rabobank
Greencat
Jan de Rijk
Reuma Revalidatie Rotterdam
Robeco
VU Medisch Centrum
CHS
LUMC
TomTom
TKP
NCCW
Erasmus MC
UMCG
VIR
ANWB
BVA Auctions
D-Reizen
STEDIN