Weblogic 9.2 MP4 – Creating and Configuring WebLogic Domains Using WLST Offline

This enabling of WLST applies to version  9.2 MP4 of WebLogic.
WLST enables you to create a new domain or update an existing domain without connecting to a running WebLogic Server (that is, using WLST offline)—supporting the same functionality as the Configuration Wizard.
You can create new configuration information, and retrieve and change existing configuration information that is persisted in the domain configuration files (located in the config directory, for example, config.xml) or in a domain template JAR created using Template Builder.

Stepping Through a Sample Script: Creating a Domain Using WLST Offline

The following example steps through a sample script that creates a WebLogic domain using the Basic WebLogic Server Domain template.
The sample script demonstrates:
  • how to open a domain template;
  • create and edit configuration objects;
  • write the domain configuration information to the specified directory;
  • close the domain template
The script shown is installed with your product at WL_HOMEcommontemplatesscriptswlstbasicWLSDomain.py, where WL_HOME refers to the top-level installation directory for WebLogic Server.
See also WLST Offline Sample Scripts for a description of the full set of sample scripts that are installed with your product.
To create a WebLogic domain using the Basic WebLogic Server Domain template:
    1. Open an existing domain template (assuming WebLogic Server is installed at c:/bea/weblogic92). In this example, we open the Basic WebLogic Server Domain template.

readTemplate('c:/bea/weblogic92/common/templates/domains/wls.jar')
Note:
 
When you open a template or domain, WLST is placed into the configuration bean hierarchy for that domain, and the prompt is updated to reflect the current location in the configuration hierarchy. For example:
Note: wls:/offline/base_domain>
Note: WebLogic Server configuration beans exist within a hierarchical structure. Similar to a file system, the hierarchies correspond to drives; types and instances are directories; attributes and operations are files. WLST traverses the hierarchical structure of configuration beans using commands such as cd, ls, and pwd in a similar way that you would navigate a file system in a UNIX or Windows command shell. After navigating to an configuration bean instance, you interact with the bean using WLST commands. For more information, see Navigating and Interrogating MBeans.
    1. Configure the domain.
    1. Configure the Administration Server and SSL port.

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

create('AdminServer','SSL')
cd('SSL/AdminServer')
set('Enabled', 'True')
set('ListenPort', 7002)
    1. Define the default user password.

cd('/')
cd('Security/base_domain/User/weblogic')
cmo.setPassword('weblogic')
    1. Create a JMS Server.

cd('/')
create('myJMSServer', 'JMSServer')
    1. Create a JMS system resource.

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

Note: WLST exposes a directory hierarchy for the MBeans in the WebLogic Server MBean server. This hierarchy is of the form attribute name/instance name. You can use the cd command to navigate to other MBeans within the attributes. For example, if the attribute name is Servers and the instance name is myserver, you can use the following command:

Note: cd("Servers/myserver")

Note: Many of the MBeans in the WebLogic Server MBean server contain a Name attribute. If an MBean contains a Name attribute, then that name is used as the instance name. However, when the Name attribute is not available for an MBean, WLST constructs the instance name to be of the NO_NAME_x format. Initial value of x is 0 and this value is incremented by 1.
    1. Create a JMS queue and its subdeployment.

myq=create('myQueue','Queue')
myq.setJNDIName('jms/myqueue')
myq.setSubDeploymentName('myQueueSubDeployment')
cd('/')
cd('JMSSystemResource/myJmsSystemResource')
create('myQueueSubDeployment', 'SubDeployment')

    1. Create a JDBC data source, configure the JDBC driver, and create a new JDBC user.

cd('/')
create('myDataSource', 'JDBCSystemResource')
cd('JDBCSystemResource/myDataSource/JdbcResource/myDataSource')
create('myJdbcDriverParams','JDBCDriverParams')
cd('JDBCDriverParams/NO_NAME_0')
set('DriverName','com.pointbase.jdbc.jdbcUniversalDriver')
set('URL','jdbc:pointbase:server://localhost/demo')

set('PasswordEncrypted', 'PBPUBLIC')
set('UseXADataSourceInterface', 'false')
create('myProps','Properties')
cd('Properties/NO_NAME_0')
create('user', 'Property')
cd('Property/user')
cmo.setValue('PBPUBLIC')

cd(‘/JDBCSystemResource/myDataSource/JdbcResource/myDataSource’)
create(‘myJdbcDataSourceParams’,’JDBCDataSourceParams’)
cd(‘JDBCDataSourceParams/NO_NAME_0’)
set(‘JNDIName’, java.lang.String(«myDataSource_jndi»))

cd(‘/JDBCSystemResource/myDataSource/JdbcResource/myDataSource’)
create(‘myJdbcConnectionPoolParams’,’JDBCConnectionPoolParams’)
cd(‘JDBCConnectionPoolParams/NO_NAME_0’)
set(‘TestTableName’,’SYSTABLES’)


    1. Target the resources.

cd('/')
assign('JMSServer', 'myJMSServer', 'Target', 'AdminServer')
assign('JMSSystemResource.SubDeployment', 'myJmsSystemResource.myQueueSubDeployment', 'Target', 'myJMSServer')
assign('JDBCSystemResource', 'myDataSource', 'Target', 'AdminServer')

    1. Save the domain.

setOption('OverwriteDomain', 'true')
writeDomain('c:/bea/user_projects/domains/wls_testscript')

    1. Close the current domain template.

closeTemplate()

    1. Exit WLST.

exit()
Additional information can be found in this link.

Deja una respuesta