Validate properties files using wsadmin.sh
Use this topic to validate configuration properties before applying properties files to the configuration.
Use the extractConfigProperties command in the PropertiesBasedConfiguration command group to extract a properties file from the configuration. Use a text editor to modify the properties in the properties file.
There are two steps to validate a properties file before applying it to the configuration. First, use the validateConfigProperties command to validate the properties file. Then, use the applyConfigProperties command and the -validate option to apply the properties and validate the file simultaneously.
Tasks
Use the validateConfigProperties command to validate a properties file.
- Start the wsadmin scripting tool.
- Validate the properties file of interest.
For this example, validate the following EJBContainer properties file:
# # SubSection 1.0 # EJBContainer # ResourceType=EJBContainer ImplementingResourceType=EJBContainer ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName} :ApplicationServer=ID#ApplicationServer_1:EJBContainer=ID#EJBCon ntainer_1 AttributeInfo=components # # #Properties # EJBTimer={} #ObjectName*(null) name=null defaultDatasourceJNDIName=null inactivePoolCleanupInterval=30000 #long passivationDirectory="${USER_INSTALL_ROOT}/temp" enableSFSBFailover=true#boolean server=null parentComponent=Network Deployment ServerAlways validate the entire properties file. Do not validate subsections of files. Use the validateConfigProperties command to validate the properties file...
AdminTask.validateConfigProperties('[-propertiesFileName ejbcontainer.props -variablesMapFileName ejbprops.vars -reportFileName report.txt]')
The command returns a value of true if the system successfully validates the properties file. The command returns a value of false if the system does not validate the file.
The command also generates a report file and records configuration actions such as:
- changes to property values.
- no change to property values when the configuration value is the same as defined in the properties file.
- no change to read-only property values.
- exceptions.
The following example displays a sample report file:
ADMG0820I: Start applying properties from file ejbcontainer.props ADMG0818I: Processing section EJBContainer:ApplicationServer. ADMG0810I: Not changing value for this property EJBTimer. New value specified is same as current value {}. ADMG0810I: Not changing value for this property defaultDatasourceJNDIName. New value specified is same as current value null. ADMG0811I: Changing value for this property enableSFSBFailover. New value specified is true. Old value was false. ADMG0810I: Not changing value for this property inactivePoolCleanupInterval. New value specified is same as current value 30000. ADMG0810I: Not changing value for this property name. New value specified is same as current value null. ADMG0807I: Property parentComponent is readonly. Will not be modified ADMG0810I: Not changing value for this property passivationDirectory. New value specified is same as current value ${USER_INSTALL_ROOT}/temp. ADMG0807I: Property server is readonly. Will not be modified ADMG0819I: End Processing section EJBContainer:ApplicationServer.To make the reports more concise, specify the reportFilterMechanism parameter with the validateConfigProperties command to only report errors and changes to the configuration:
AdminTask.validateConfigProperties('[-propertiesFileName ejbcontainer.props -variablesMapFileName ejbprops.vars -reportFileName report.txt -reportFilterMechanism Errors_And_Changes]')The filtered report file displays error and configuration changes only...
ADMG0820I: Start applying properties from file ejbcontainer.props ADMG0811I: Changing value for this property enableSFSBFailover. New value specified is true. Old value was false. AADMG0831E: Value specified for property inactivePoolCleanupInterval is not a valid type. Specified value asdf, Required type long. ADMG0821I: End applying properties from file ejbcontainer.props.
What to do next
If validation of a properties file fails, the generated report file states the reason for failure. The report file lists any changes that are made to the configuration and any errors.
To identify the problem, we can set the report filter mechanism parameter to report only errors. Otherwise the generated report file might be too big to look for actual errors. In a report file with a combination of changes and errors, search for ADMGXXXXE messages or for one of the following ADMGXXXX messages:
- ADMG0809I
- ADMG0815I
- ADMG0826I
- ADMG0829I
- ADMG0831I
- ADMG0832I
- ADMG0833I
- ADMG0834I
- ADMG0835I
These ADMG messages are errors. If the report has any of these ADMG messages, correct the error condition in the properties file. The error caused the specified property or property value to be not valid.
Applying properties files Create server, cluster, application, or authorization group objects using properties files and wsadmin scripting Create and delete configuration objects using properties files and wsadmin scripting Deleting server, cluster, application, or authorization group objects using properties files Manage environment configurations with properties files Extracting properties files Extracting properties files to troubleshoot the environment Manage servers, nodes and cells with scripting PropertiesBasedConfiguration .