Problem:
- Product: VisiBroker for Java
- Product Version: 8.0
- Product Component: Configuration, Properties
- JDK: JDK 1.5
- Platform/OS Version: All
There are a few ways to pass a VisiBroker properties to the JVM through the vbj launcher:
1. Command line parameter using –D
2. Command line system properties using –VBJprop or -J
3. Properties file using –DORBpropStorage
4. Passing to the orb.init method in the code
5. vbj.config
Which method will take precedence over the other?
Resolution:
Each of the methods will pass in a different value for the property vbroker.orb.initRef for the tests.
- Command line parameter using -D (port no:42345)
- Command line system properties using -VBJprop or -J (port no:52345)
- Properties file using -DORBpropStorage (port no:22345)
- Passing to the orb.init method in the code (port no: 32345)
- Using configuration file vbj.config (port no: 12345)
Test Scenario:
vbj -Dvbroker.orb.initRef=NameService=corbaloc::localhost:42345/NameService -DORBpropStorage=client.properties Client
Result: Command line parameter using -D take precedence and connect at port no:42345
vbj -DORBpropStorage=client.properties -Dvbroker.orb.initRef=NameService=corbaloc::localhost:42345/NameService Client
Result: Command line parameter using -D take precedence and connect at port no:42345
vbj -DORBpropStorage=client.properties -VBJprop vbroker.orb.initRef=NameService=corbaloc::localhost:52345/NameService Client
Result: Command line system properties takes precedence and connect at port no:52345
vbj -DORBpropStorage=client.properties Client
Result: vbj.config takes precedence and connect at port no:12345
vbj Client
Result: vbj.config takes precedence and connect at port no:12345
Mask off the vbroker.orb.initRef property in vbj.config file & run the following command
vbj -DORBpropStorage=client.properties Client
Result: Properties file using –DORBpropStorage take precedence and connect at port no: 22345
Mask off the vbroker.orb.initRef property in vbj.config file & run the following command
vbj Client
Result: Passing of the properties to the orb.init() through the source code take precedence and connect at port no:32345
The above test scenarios conclude the precedence is defined as shown below:
1. Command line parameter using -D
2. Command line system properties using -VBJprop or -J
3. vbj.config
4. Properties file using -DORBpropStorage
5. Passing to the orb.init method in the code
vbj.config is a VisiBroker defined properties file for VisiBroker’s use only. Application or VisiBroker properties to customize the orb for the application are not advised to use the vbj.config to pass in the properties. The best practice is to use another properties file and pass in through the -DORBpropStorage.
Attachments
#Security
#VisiBroker