Tuesday 18 November 2014

Offline WLST script to create domain in WLS



WLST SCRIPT:-


  1. # This is an Offline  WLST script to create a WLS 12.1.3.0 (Oracle Weblogic Server 12c) Domain

  2. # Domain consists of:
  3. # 1. Admin Server
  4. # 2. Two Managed Servers
  5. # 3. A Cluster with Two Managed Server
  6. # 4. An application deployed to the cluster
  7. # Read a domain template
  8. print('ReadingTemplate - D:/Oracle/12cR1/one/wlserver_12.1.3/common/templates/domains/wls.jar')
  9. readTemplate('D:/Oracle/12cR1/one/wlserver_12.1.3/common/templates/domains/wls.jar')
  10. # Admin Server
  11. print('Creating Server - Admin Server')
  12. cd('Servers/AdminServer')
  13. set('ListenAddress','localhost')
  14. set('ListenPort'7001)
  15. create('AdminServer','SSL')
  16. cd('SSL/AdminServer')
  17. set('Enabled''True')
  18. set('ListenPort'7002)
  19. # Security
  20. print('Creating Password')
  21. cd('/')
  22. cd('Security/base_domain/User/weblogic')
  23. cmo.setPassword('welcome1')
  24. # Start Up
  25. print('Setting StartUp Options')
  26. setOption('CreateStartMenu''false')
  27. setOption('ServerStartMode''dev')
  28. setOption('JavaHome','D:/Oracle/11gR1/one/jrockit_170_75_R27.6.2-20')
  29. setOption('OverwriteDomain''true')
  30. # Create Domain to File System
  31. print('Writing Domain To File System')
  32. writeDomain('D:/Oracle/12cR1/one/user_projects/domains/OfflineDomain_WLST')
  33. closeTemplate()
  34. # Read the Created Domain
  35. print('Reading the Domain from In Offline Mode')
  36. readDomain('D:/Oracle/12cR1/one/user_projects/domains/OfflineDomain_WLST')
  37. # Creating Managed Servers
  38. print('Creating Server - MS1 on Port # 8001')
  39. cd('/')
  40. create('MS1''Server')
  41. cd('Server/MS1')
  42. set('ListenPort'8001)
  43. set('ListenAddress''localhost')
  44. print('Creating Server - MS2 on Port # 8011')
  45. cd('/')
  46. create('MS2''Server')
  47. cd('Server/MS2')
  48. set('ListenPort'8011)
  49. set('ListenAddress''localhost')
  50. # Create and configure a cluster and assign the Managed Servers to that cluster.
  51. print('Creating Cluster - WLSTCluster and adding MS1, MS2')
  52. cd('/')
  53. create('WLSTCluster''Cluster')
  54. assign('Server''MS1,MS2','Cluster','WLSTCluster')
  55. cd('Cluster/WLSTCluster')
  56. set('MulticastAddress''237.0.0.101')
  57. set('MulticastPort'8050)
  58. set('WeblogicPluginEnabled''true')
  59. #Create a new application deployment - Deployment Archive : "d:/Lou/VersionInfo.war"
  60. print('Deploying application named VersionInfo from d:\Lou\VersionInfo.war')
  61. cd('/')
  62. myApp=create('VersionInfo''AppDeployment')
  63. myApp.setSourcePath('d:/Lou/VersionInfo.war')
  64. assign('AppDeployment''VersionInfo''Target''WLSTCluster')
  65. # updating the changes
  66. print('Finalizing the changes')
  67. updateDomain()
  68. closeDomain()
  69. # Exiting
  70. print('Exiting...')
  71. exit()
  72. # Code written by:
  73. # Krushna Sunkara
---

No comments:

Post a Comment