+

Search Tips   |   Advanced Search

Validating properties files


Overview

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.

To validate a properties file before applying it to the configuration...

  1. Use the validateConfigProperties command to validate the properties file
  2. 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. Start the wsadmin scripting tool.

  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
      #EJBConntainer_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 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]')

    Returns 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: Change 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: Change 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:

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.


Related tasks

Apply 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
  • Delete 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 and nodes
  • PropertiesBasedConfiguration (AdminTask)