Validating properties files


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.

Best practice: 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

  Use the validateConfigProperties command to validate a properties file.

  1. Launch the wsadmin scripting tool using the Jython scripting language.

  2. 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=ND Server

    Always validate the entire properties file. Do not validate subsections of files. Use the validateConfigProperties command to validate the properties file, as the following Jython example demonstrates:

    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, as the following sample output demonstrates:

    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. 
    

 

Related tasks


Applying properties files
Create server, cluster, application, or authorization group objects using properties files
Create and deleting configuration objects using properties files
Delete server, cluster, application, or authorization group objects using properties files
Manage environment configurations using properties files
Extracting properties files
Extracting properties files to troubleshoot the environment
Manage servers and nodes with scripting

 

Related


PropertiesBasedConfiguration