简体   繁体   中英

Weblogic domain creating using wlst scripts

I'm trying to create a weblogic domain by script. When I create it using config.sh wizard, it works as smoothly as it should. However, when trying to use WLST, I'm getting an error:

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.

Does anyone has a sample script to create a domain with OSB on 12.2?

@edit: After updating templates, like this:

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

I wonder how to specify the password they ask? Any suggestion?

I get this:

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.

And to be honest, I don't find the documentation very useful. https://docs.oracle.com/middleware/1221/wls/WLSTG/domains.htm#WLSTG406

When you start jdeveloper and open the 'Application Servers' pane and start the IntegratedWebLogicServer for the first time, jdeveloper will create an OSB domain for you and when it does that, it generates a wlst script under your $JDEV_USER_DIR/system12.2.1..... folder. That wlst script can be saved and reused.

I got this script which I customized and now re-use to re-create an OSB domain whenever I need to...

#===========================================================================
# 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", None],
  ["Oracle WSM Policy Manager", None],
  ["Oracle ADF Development Mode Logging", None],
  ["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 ***");  
  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM