使用 wlst 脚本创建 Weblogic 域

问题描述

我正在尝试通过脚本创建一个 weblogic 域。当我使用 config.sh 向导创建它时,它可以正常工作。但是,在尝试使用 WLST 时,出现错误

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline> selectTemplate('Basic WebLogic Server Domain','12.2.1.1')
Error: selectTemplate() Failed. Do dumpStack() to see details.
Error: No domain or domain template has been read.
wls:/offline>selectTemplate('Oracle Service Bus Reference Configuration','12.2.1.4.0')
wls:/offline/>loadTemplates()
wls:/offline/base_domain>
wls:/offline/base_domain>cd('Servers/AdminServer')
wls:/offline/base_domain/Server/AdminServer>set('ListenAddress','')
wls:/offline/base_domain/Server/AdminServer>set('ListenPort',7001)
wls:/offline/base_domain/Server/AdminServer>
wls:/offline/base_domain/Server/AdminServer>create('AdminServer','SSL')
Proxy for AdminServer: Name=AdminServer,Type=SSL
wls:/offline/base_domain/Server/AdminServer>cd('SSL/AdminServer')
wls:/offline/base_domain/Server/AdminServer/SSL/AdminServer>set('Enabled','False')
wls:/offline/base_domain/Server/AdminServer/SSL/AdminServer>set('ListenPort',7002)
wls:/offline/base_domain/Server/AdminServer/SSL/AdminServer>
wls:/offline/base_domain/Server/AdminServer/SSL/AdminServer>cd('/')
wls:/offline/base_domain>
wls:/offline/base_domain>cd('Security/base_domain/User/weblogic')
wls:/offline/base_domain/Security/base_domain/User/weblogic>cmo.setPassword('weblogic123')
wls:/offline/base_domain/Security/base_domain/User/weblogic>writeDomain('/home/oracle/12.2.1/user_projects/domains/osb25_domain')
com.oracle.cie.domain.script.ScriptException: 64254: Error occurred in "OPSS Processing" phase execution
64254: Encountered error: oracle.security.opss.tools.lifecycle.LifecycleException: JDBC password for opss-audit-DBDS is missing for configuring security store to database.

有人有在 12.2 上使用 OSB 创建域的示例脚本吗?

@编辑: 更新模板后,像这样:

selectTemplate('Basic WebLogic Server Domain','12.2.1.3.0')
selectTemplate('Oracle Service Bus Reference Configuration','12.2.1.4.0')
loadTemplates()

我想知道他们问的密码如何指定?有什么建议吗?

我明白了:

com.oracle.cie.domain.script.ScriptException: 64254: Error occurred in "OPSS Processing" phase execution
64254: Encountered error: oracle.security.opss.tools.lifecycle.LifecycleException: JDBC password for opss-audit-DBDS is missing for configuring security store to database.

老实说,我觉得文档不是很有用。 https://docs.oracle.com/middleware/1221/wls/WLSTG/domains.htm#WLSTG406

解决方法

当您启动 jdeveloper 并打开“应用程序服务器”窗格并首次启动 IntegratedWebLogicServer 时,jdeveloper 将为您创建一个 OSB 域,当它这样做时,它会在您的 $JDEV_USER_DIR/system12 下生成一个 wlst 脚本。 2.1..... 文件夹。该 wlst 脚本可以保存和重复使用。

我得到了这个我自定义的脚本,现在可以在需要时重新使用它来重新创建 OSB 域...

#===========================================================================
# Create osb domain for JDeveloper application development 
# runtime.
#
# The script creates a default osb domain.  
# The default domain consists of a single server,# representing a typical development environment.  This type of configuration 
# is not recommended for production environments.
#===========================================================================

import os

if not 'JDEV_USER_DIR' in os.environ:
  print("Error:  JDEV_USER_DIR environment variable not set.")
  exit()
  
if not 'ORACLE_HOME' in os.environ:
  print("Error:  ORACLE_HOME environment variable not set.")
  exit()  
  
print("Creating Default Domain")

#%%%VARIABLE_ASSIGNMENTS%%%

templateFile =  'Basic WebLogic Server Domain'
targetDomain =  os.environ['JDEV_USER_DIR'] + '/system12.2.1.4.42.190911.2248/DefaultDomain/'
serverName =    'DefaultServer'
domainAdmin =   'weblogic'
domainPassword = 'welcome1'
listenAddress = ''
listenPort =    '7001'
sslListenPort = '7002'
cfgGrpProfile = 'Compact'
jdevHome = os.environ['ORACLE_HOME'] + '/jdeveloper/'
commonComponentsHome = os.environ['ORACLE_HOME'] + '/oracle_common/'


#===========================================================================
# Open a domain template.
#===========================================================================

print("[progress] Reading template: " + templateFile);
setTopologyProfile(cfgGrpProfile)
selectTemplate(templateFile)
loadTemplates()

#===========================================================================
# Configure the domain
#===========================================================================

#%%%BASE_DOMAIN_CONFIGURE_START%%%
cd('Servers/AdminServer')

print('Setting Name to \'' + serverName + '\'')
set('Name',serverName)

print('Setting ListenAddress to \'' + listenAddress + '\'')
set('ListenAddress',listenAddress)

print('Setting ListenPort to ' + listenPort)
set('ListenPort',int(listenPort))

set('TunnelingEnabled',1)

cd('/Servers/' + serverName)
create (serverName,'SSL')
cd('SSL/' + serverName)

print('Enabling SSL using port ' + sslListenPort)
set('Enabled','true')
set('ListenPort',int(sslListenPort))

set('ClientCertificateEnforced','false')
set('TwoWaySSLEnabled','true')

cd('/')
cd('Security/base_domain/User/weblogic')

print('Setting domain administrator to \'' + domainAdmin + '\'')
cmo.setName(domainAdmin)

print('Setting domain password.')
cmo.setPassword(domainPassword)
#%%%BASE_DOMAIN_CONFIGURE_END%%%

#===========================================================================
# Write the domain and close the domain template.
#===========================================================================

setOption('OverwriteDomain','true')

print("[progress] Writing domain: " + targetDomain);
writeDomain(targetDomain)

print("[progress] Closing template.")
closeTemplate()

#===========================================================================
# Set environment variables used by extension templates.
#===========================================================================
os.putenv('JDEV_HOME',jdevHome)
os.putenv('COMMON_COMPONENTS_HOME',commonComponentsHome)
os.putenv('DOMAIN_HOME',targetDomain)

#===========================================================================
# Extend the domain
#===========================================================================

#%%%DOMAIN_EXTENSION_TEMPLATES_DECLARTION%%%
templates = \
[
  ["Oracle ADRS",None],["Oracle JRF",["Oracle WSM Policy Manager",["Oracle ADF Development Mode Logging",["Oracle Service Bus",None]
]

try:
  if len(templates) > 0:

#%%%START_TEMPLATE_LOOP%%%
    for t in templates:
      print("[progress] Reading domain: " + targetDomain)
      readDomain(targetDomain);
      print("[progress] Adding domain extension template: " + t[0] + " " + (t[1] or "") )
      if t[1] is None:
        selectTemplate(t[0])
      else:
        selectTemplate(t[0],t[1])
      loadTemplates()
      print("[progress] Updating domain.")
      updateDomain()
      print("[progress] Closing domain.")
      closeDomain()
#%%%END_TEMPLATE_LOOP%%%

except:
  dumpStack()
  raise
  
print("*** Domain processing complete ***");  
  

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...