use WLST to create weblogic domain automatically

#FileName:createDomain.py

#=======================================================================================

# This is an example of a simple WLST offline configuration script. The script creates 
# a simple WebLogic domain using the Basic WebLogic Server Domain template. The script 
# demonstrates how to open a domain template, create and edit configuration objects, 
# and write the domain configuration information to the specified directory.
#
# This sample uses the demo Pointbase Server that is installed with your product.
# Before starting the Administration Server, you should start the demo Pointbase server
# by issuing one of the following commands:
#
# Windows: WL_HOME\common\eval\pointbase\tools\startPointBase.cmd
# UNIX: WL_HOME/common/eval/pointbase/tools/startPointBase.sh
#
# (WL_HOME refers to the top-level installation directory for WebLogic Server.)
#
# The sample consists of a single server, representing a typical development environment. 
# This type of configuration is not recommended for production environments.
#
# Please note that some of the values used in this script are subject to change based on 
# your WebLogic installation and the template you are using.
#
# Usage: 
#      java weblogic.WLST <WLST_script> 
#
# Where: 
#      <WLST_script> specifies the full path to the WLST script.
#=======================================================================================


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


readTemplate("C:/Oracle/Middleware/wlserver_10.3/common/templates/domains/wls.jar")


#=======================================================================================
# Configure the Administration Server and SSL port.
#
# To enable access by both local and remote processes, you should not set the 
# listen address for the server instance (that is, it should be left blank or not set). 
# In this case, the server instance will determine the address of the machine and 
# listen on it. 
#=======================================================================================


cd('Servers/AdminServer')
set('ListenAddress','')
set('ListenPort', 7001)


create('AdminServer','SSL')
cd('SSL/AdminServer')
set('Enabled', 'True')
set('ListenPort', 7002)


#=======================================================================================
# Define the user password for weblogic.
#=======================================================================================


cd('/')
cd('Security/base_domain/User/weblogic')
# Please set password here before using this script, e.g. cmo.setPassword('value')
cmo.setPassword('Welcome1')
#=======================================================================================
# Create a JMS Server.
#=======================================================================================


cd('/')
create('mccJMSServer', 'JMSServer')


#=======================================================================================
# Create a JMS System resource. 
#=======================================================================================


cd('/')
create('mccJmsSystemResource', 'JMSSystemResource')
cd('JMSSystemResource/mccJmsSystemResource/JmsResource/NO_NAME_0')


#=======================================================================================
# Create a JMS Queue and its subdeployment.
#=======================================================================================


mccq=create('mccQueue','Queue')
mccq.setJNDIName('jms/mccqueue')
mccq.setSubDeploymentName('mccQueueSubDeployment')


cd('/')
cd('JMSSystemResource/mccJmsSystemResource')
create('mccQueueSubDeployment', 'SubDeployment')


#=======================================================================================
# Create and configure a JDBC Data Source, and sets the JDBC user.
#=======================================================================================


cd('/')
create('mccDataSource', 'JDBCSystemResource')
cd('JDBCSystemResource/mccDataSource/JdbcResource/mccDataSource')
create('mccJdbcDriverParams','JDBCDriverParams')
cd('JDBCDriverParams/NO_NAME_0')
set('DriverName','oracle.jdbc.driver.OracleDriver')
set('URL','jdbc:oracle:thin:@localhost:1521:xe')
set('PasswordEncrypted', 'mc2011')
set('UseXADataSourceInterface', 'false')
create('mccProps','Properties')
cd('Properties/NO_NAME_0')
create('user', 'Property')
cd('Property/user')
cmo.setValue('system')


cd('/JDBCSystemResource/mccDataSource/JdbcResource/mccDataSource')
create('mccJdbcDataSourceParams','JDBCDataSourceParams')
cd('JDBCDataSourceParams/NO_NAME_0')
set('JNDIName', java.lang.String("mccDataSource_jndi"))


cd('/JDBCSystemResource/mccDataSource/JdbcResource/mccDataSource')
create('mccJdbcConnectionPoolParams','JDBCConnectionPoolParams')
cd('JDBCConnectionPoolParams/NO_NAME_0')
set('TestTableName','DUAL')


#=======================================================================================
# Target resources to the servers. 
#=======================================================================================


cd('/')
assign('JMSServer', 'mccJMSServer', 'Target', 'AdminServer')
assign('JMSSystemResource.SubDeployment', 'mccJmsSystemResource.mccQueueSubDeployment', 'Target', 'mccJMSServer')
assign('JDBCSystemResource', 'mccDataSource', 'Target', 'AdminServer')


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


setOption('OverwriteDomain', 'true')
writeDomain('C:/mydomains/mccDomain')
closeTemplate()


#=======================================================================================
# Exit WLST.
#=======================================================================================


exit()
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值