← All posts

Offline WLST script to create domain in WLS 11gR1

Cluster, managed servers, and a WAR — no server running

Unni Pillai
Unni Pillai

---

Posted by Unni on Sun 4 Oct 11:15 download

  1. # This is an Offline  WLST script to create a WLS 10.3.1 (Oracle Weblogic Server 11gR1) Domain

  2. #

  3. # Domain consists of:

  4. # 1. Admin Server

  5. # 2. Two Managed Servers

  6. # 3. A Cluster with Two Managed Server

  7. # 4. An application deployed to the cluster

  8. # Read a domain template

  9. print(‘Reading Template - D:/Oracle/11gR1/one/wlserver_10.3/common/templates/domains/wls.jar’)

  10. readTemplate(‘D:/Oracle/11gR1/one/wlserver_10.3/common/templates/domains/wls.jar’)

  11. # Admin Server

  12. print(‘Creating Server - Admin Server’)

  13. cd(‘Servers/AdminServer’)

  14. set(‘ListenAddress’,‘localhost’)

  15. set(‘ListenPort’, 7001)

  16. create(‘AdminServer’,‘SSL’)

  17. cd(‘SSL/AdminServer’)

  18. set(‘Enabled’, ‘True’)

  19. set(‘ListenPort’, 7002)

  20. # Security

  21. print(‘Creating Password’)

  22. cd(’/’)

  23. cd(‘Security/base_domain/User/weblogic’)

  24. cmo.setPassword(‘welcome1’)

  25. # Start Up

  26. print(‘Setting StartUp Options’)

  27. setOption(‘CreateStartMenu’, ‘false’)

  28. setOption(‘ServerStartMode’, ‘dev’)

  29. setOption(‘JavaHome’,‘D:/Oracle/11gR1/one/jrockit_160_05_R27.6.2-20’)

  30. setOption(‘OverwriteDomain’, ‘true’)

  31. # Create Domain to File System

  32. print(‘Writing Domain To File System’)

  33. writeDomain(‘D:/Oracle/11gR1/one/user_projects/domains/OfflineDomain_WLST’)

  34. closeTemplate()

  35. # Read the Created Domain

  36. print(‘Reading the Domain from In Offline Mode’)

  37. readDomain(‘D:/Oracle/11gR1/one/user_projects/domains/OfflineDomain_WLST’)

  38. # Creating Managed Servers

  39. print(‘Creating Server - MS1 on Port # 8001’)

  40. cd(’/’)

  41. create(‘MS1’, ‘Server’)

  42. cd(‘Server/MS1’)

  43. set(‘ListenPort’, 8001)

  44. set(‘ListenAddress’, ‘localhost’)

  45. print(‘Creating Server - MS2 on Port # 8011’)

  46. cd(’/’)

  47. create(‘MS2’, ‘Server’)

  48. cd(‘Server/MS2’)

  49. set(‘ListenPort’, 8011)

  50. set(‘ListenAddress’, ‘localhost’)

  51. # Create and configure a cluster and assign the Managed Servers to that cluster.

  52. print(‘Creating Cluster - WLSTCluster and adding MS1, MS2’)

  53. cd(’/’)

  54. create(‘WLSTCluster’, ‘Cluster’)

  55. assign(‘Server’, ‘MS1,MS2’,‘Cluster’,‘WLSTCluster’)

  56. cd(‘Cluster/WLSTCluster’)

  57. set(‘MulticastAddress’, ‘237.0.0.101’)

  58. set(‘MulticastPort’, 8050)

  59. set(‘WeblogicPluginEnabled’, ‘true’)

  60. # Create a new application deployment - Deployment Archive : “d:/Lou/VersionInfo.war”

  61. print(‘Deploying application named VersionInfo from d:\Lou**\V**ersionInfo.war’)

  62. cd(’/’)

  63. myApp=create(‘VersionInfo’, ‘AppDeployment’)

  64. myApp.setSourcePath(‘d:/Lou/VersionInfo.war’)

  65. assign(‘AppDeployment’, ‘VersionInfo’, ‘Target’, ‘WLSTCluster’)

  66. # updating the changes

  67. print(‘Finalizing the changes’)

  68. updateDomain()

  69. closeDomain()

  70. # Exiting

  71. print(‘Exiting…’)

  72. exit()

  73. # Code written by:

  74. # Unnikrishnan Pillai

---