스크립트를 사용하여 모듈 레벨에서 Stateful 세션 Bean 장애 복구 구성
스크립트 및 wsadmin 도구를 사용하여 Stateful 세션 Bean 장애 복구에 대해 애플리케이션을 구성합니다.
시작하기 전에
이 태스크 정보
프로시저
- AdminConfig 오브젝트를 사용하여
애플리케이션에서 EJB 모듈에 대한 Stateful 세션 Bean 장애 복구 구성을 표시합니다.
- wsadmin 스크립트 클라이언트를 시작하십시오.
- Jacl 사용
-
wsadmin
- Jython 사용
-
wsadmin -lang Jython
- 애플리케이션에 대한 배치 구성 오브젝트를 식별하여 이를 변수로
지정하십시오. 예를 들어 다음과 같습니다.
- Jacl 사용
-
set app [$AdminConfig getid /Deployment:EJBinWARTest/] set depObj [$AdminConfig showAttribute $app deployedObject]
- Jython 사용
-
app = AdminConfig.getid("/Deployment:EJBinWARTest/" ) depObj = AdminConfig.showAttribute(app, "deployedObject" )
- 애플리케이션의 모듈 목록을 가져오십시오.
- Jacl 사용
-
set modules [lindex [$AdminConfig showAttribute $depObj modules] 0]
- Jython 사용
-
modules = AdminConfig.showAttribute(depObj, "modules" ) modules = modules.replace('[','').replace(']','') modules = modules.split(' ')
- 이 예제에서 EJB 모듈, EJBBean.jar은 엔터프라이즈 Bean을 포함하고
웹 모듈, EJB2xInWARBean.war은 다른 엔터프라이즈 Bean을 포함합니다.
다음 코드에서는 이러한 엔터프라이즈 Bean 각각에 대한 Stateful 세션 Bean 구성을 수정하는 방법을 보여줍니다.
- Jacl 사용
-
# Assign the EJB and web module configuration IDs to variables ejbmod and webmod: foreach module $modules { set moduleName [$AdminConfig show $module uri] if { [string first "EJBBean.jar" $moduleName] >= 0} { set ejbmod $module } if { [string first "EJB2xInWARBean.war" $moduleName] >= 0} { set webmod $module } }
- Jython 사용
-
# Assign the EJB and web module configuration IDs to variables ejbmod and webmod: for module in modules: moduleName = AdminConfig.showAttribute(module, 'uri') if moduleName.find('EJBBean.jar') >= 0: ejbmod = module if moduleName.find('EJB2xInWARBean.war') >= 0 : webmod = module
- EJB 모듈 구성 오브젝트를 가져오십시오.
- Jacl 사용
-
# Get the single EJB module configuration object associated with the pure EJB module: set ejbConfig [lindex [$AdminConfig showAttribute $ejbmod configs] 0] if { ($ejbConfig == "") } { puts "\nejbConfig not present - creating one" set ejbConfig [$AdminConfig create EJBModuleConfiguration $ejbmod {{enableSFSBFailover true} {overrideDefaultDRSSettings false}}] set attrs [list config $ejbConfig] set targetMappings [lindex [$AdminConfig showAttribute $ejbmod targetMappings] 0] $AdminConfig modify $targetMappings [list $attrs] } else { puts "\nejbConfig present" }
- Jython 사용
-
# Get the list of configuration objects associated with the pure EJB module: ejbmodConfigs = AdminConfig.showAttribute (ejbmod, 'configs') if (ejbmodConfigs): print "\nejbmodConfigs present" # Extract the single EJB module configuration object: ejbConfig = ejbmodConfigs.replace('[','').replace(']','') print "\nejbConfig:" print AdminConfig.show(ejbConfig) else: print "\nejbmodConfigs not present - creating one" ecAttrs = [] attr1 = ["enableSFSBFailover", "true"] attr2 = ["overrideDefaultDRSSettings", "false"] ecAttrs.append(attr1) ecAttrs.append(attr2) ejbConfig = AdminConfig.create('EJBModuleConfiguration', ejbmod, ecAttrs) tmAttrs = ['config', ejbConfig] targetMappings = AdminConfig.showAttribute (ejbmod, 'targetMappings') targetMappings = targetMappings[1:len(targetMappings)-1] AdminConfig.modify(targetMappings, [tmAttrs])
- EJB 모듈의 Stateful 세션 Bean 장애 복구 구성 설정을 표시하십시오.
- Jacl 사용
-
# Show the Stateful session bean failover configuration of the EJB module: puts "\nStateful session bean failover settings of the EJB module" puts [$AdminConfig show $ejbConfig] # Show the drsSettings of the EJB module: set drsSettings [$AdminConfig showAttribute $ejbConfig drsSettings] if { ($drsSettings == "") } { puts "drsSettings not present on the EJB module." } else { puts "\ndrsSettings of the EJB module:" puts [$AdminConfig show $drsSettings] }
- Jython 사용
-
# Show the Stateful session bean failover configuration of the EJB module: print AdminConfig.show(ejbConfig) # Show the drsSettings of the EJB module: drsSettings = AdminConfig.showAttribute (ejbConfig, 'drsSettings') if (drsSettings): print "\ndrsSettings of the EJB module:" print AdminConfig.show(drsSettings) else: print "\ndrsSettings not present on the EJB module." drsSettings = AdminConfig.showAttribute (ejbConfig, 'drsSettings') if (drsSettings): print "\ndrsSettings of the EJB module:" print AdminConfig.show(drsSettings) else: print "\ndrsSettings not present on the EJB module."
- wsadmin 스크립트 클라이언트를 시작하십시오.
- 그런 다음 AdminConfig 오브젝트를 사용하여 동일한 애플리케이션의 웹 모듈에서
엔터프라이즈 Bean에 대한 Stateful 세션 Bean 장애 복구 구성을 수정하십시오.
WAR 파일에 패키지된 EJB 모듈의 경우 단계는 비슷하지만 구성 오브젝트 목록에서 EJB 모듈을
추출하는 단계가 추가됩니다.
- 4단계에서 웹 모듈 구성 ID를 제공하여
웹 모듈과 연관된 EJB 모듈 구성 오브젝트를 가져오십시오.
- Jacl 사용
-
# Get the web module configuration object: set webmodConfig [lindex [$AdminConfig showAttribute $webmod configs] 0] # Extract the EJB module configuration object associated with the web module. set ejbInWarConfig [$AdminConfig showAttribute $webmodConfig ejbModuleConfiguration]
- Jython 사용
-
# Get the list of configuration objects associated with the web module: webmodConfigs = AdminConfig.showAttribute (webmod, 'configs') # Extract the single web module configuration object: webmodConfig = webmodConfigs.replace('[','').replace(']','') # Extract the EJB module configuration object associated with the web module. ejbInWarConfig = AdminConfig.showAttribute (webmodConfig, 'ejbModuleConfiguration')
- Stateful 세션 Bean 구성 설정을 표시하십시오.
- Jacl 사용
-
# Show the configuration of the EJB module within the web module: puts "\nStateful session bean failover settings of the EJB within the web module:" puts [$AdminConfig show $ejbInWarConfig] # Get the SFSB failover settings of the EJB module within the web module: set drsSettings [$AdminConfig showAttribute $ejbInWarConfig drsSettings] if { ($drsSettings == "") } { puts "drsSettings not present on the EJB within the Web module." } else { puts "\ndrsSettings of the EJB within the Web module:" puts [$AdminConfig show $drsSettings] }
- Jython 사용
-
print "\nStateful session bean failover configuration of the EJB module within the web module:" print AdminConfig.show(ejbInWarConfig) drsSettings = AdminConfig.showAttribute(ejbInWarConfig, 'drsSettings') if (drsSettings): print "\ndrsSettings of the EJB module within the web module:" print AdminConfig.show(drsSettings) else: print "\ndrsSettings not present on the EJB module within the web module." print "\ndrsSettings of the EJB module within the Web module:"
- Stateful 세션 Bean 구성 설정을 수정하십시오.
- Jacl 사용
-
# To enable SFSB failover for the EJB within the web module: $AdminConfig modify $ejbInWarConfig {{enableSFSBFailover "true"}}
- Jython 사용
-
# Enable SFSB failover for the EJB within the web module: AdminConfig.modify(ejbInWarConfig, [['enableSFSBFailover', 'true']])
- 4단계에서 웹 모듈 구성 ID를 제공하여
웹 모듈과 연관된 EJB 모듈 구성 오브젝트를 가져오십시오.
관련 태스크:


http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=txml_ejbsfsbf
파일 이름:txml_ejbsfsbf.html