使用本主题来验证配置属性,然后再将属性文件应用到配置。
开始之前
使用 PropertiesBasedConfiguration 命令组中的 extractConfigProperties 命令,从配置中抽取属性文件。使用文本编辑器来修改属性文件中的属性。
关于此任务
可以执行两个步骤来验证属性文件,然后再将它应用到配置。首先,使用 validateConfigProperties 命令来验证属性文件。然后,使用 applyConfigProperties 命令和 -validate 选项来应用属性,并同时对文件进行验证。
过程
使用 validateConfigProperties 命令来验证属性文件。 - 启动 wsadmin 脚本编制工具。
- 验证相关属性文件。
对于本示例,验证以下 EJBContainer 属性文件:
# # 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 Server
请始终验证整个属性文件。不要仅验证文件子节。使用
validateConfigProperties 命令来验证属性文件,如以下 Jython 示例所示:
AdminTask.validateConfigProperties('[-propertiesFileName ejbcontainer.props
-variablesMapFileName ejbprops.vars -reportFileName report.txt]')
如果系统成功验证属性文件,那么此命令会返回值 true。如果系统未验证此文件,那么此命令会返回值 false。
此命令也会生成报告文件,并记录下列配置操作,例如:
- 更改属性值。
- 当配置值与属性文件中所定义的配置值相同时,不更改属性值。
- 不更改只读属性值。
- 异常。
以下示例显示样本报告文件:
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.
要使报告更精简,请对
validateConfigProperties 命令指定 reportFilterMechanism 参数,以仅报告错误和配置更改,如以下示例所示:
AdminTask.validateConfigProperties('[-propertiesFileName ejbcontainer.props
-variablesMapFileName ejbprops.vars -reportFileName report.txt
-reportFilterMechanism Errors_And_Changes]')
已过滤的报告文件仅显示错误和配置更改,如以下样本输出如下所示:
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.
下一步做什么
如果属性文件验证失败,那么生成的报告文件陈述失败原因。报告文件列示对配置进行的任何更改以及任何错误。
要确定问题,您可以设置报告过滤器机制参数来仅报告错误。否则,生成的报告文件可能太大而无法查找实际错误。在具有更改和错误组合的报告文件中,搜索 ADMGXXXXE 消息或者搜索以下 ADMGXXXX 消息之一:
- ADMG0809I
- ADMG0815I
- ADMG0826I
- ADMG0829I
- ADMG0831I
- ADMG0832I
- ADMG0833I
- ADMG0834I
- ADMG0835I
这些 ADMG 消息是错误。如果该报告有其中任何 ADMG 消息,请更正属性文件中的错误条件。
该错误导致指定的属性或属性值无效。