• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

WLST -- problem with script that creates a cluster

 
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using WL 9.2.2. I'm trying to write a WLST script that will create a cluster with a couple of managed servers. I coped one directly from WebLogic's site (http://e-docs.bea.com/wls/docs90/config_scripting/using_WLST.html#1078952), but I'm getting errors.

Specifically, I'm getting

$HOSTNAME:"$PWD"->sh run_setup_cluster.sh

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Problem invoking WLST - Traceback (innermost last):
(no code object) at line 0
File "/export/third-party/etsbea/home/etsbea/tests/npsconfig/createcluster.py", line 2
from javax.management import *
^
SyntaxError: invalid syntax


Below is my script. I know nothing about Python but cutting and pasting from BEA's site isn't cutting it.

============Begin createcluster.py file=======================
from java.util import *
from javax.management import *
import javax.management.Attribute

print 'starting the script .... '

connect('system','weblogic','t3://localhost:7001')
clusters = "NPSCONFIG_GUI_Cluster"
ms1 = {'managed1':7019:8020,'managed2':7020:8021}

clustHM = HashMap()
edit()
startEdit()

for c in clusters:
print 'creating cluster '+c
clu = create(c,'Cluster')
clustHM.put(c,clu)
cd('Clusters/' + c)
set('MulticastAddress', '237.0.0.101')
set('MulticastPort', 9200)
set('WeblogicPluginEnabled', 'true')

cd('..\..')

clus1 = clustHM.get(clusters[0])

for m, lp, ssl_lp in ms1.items():
managedServer = create(m,'Server')
print 'creating managed server '+m
managedServer.setListenAddress('10.61.6.134')
managedServer.setListenPort(lp)
managedServer.setEnabled(0)
cd('SSL/cgServer')
managedServer.setEnabled(1)
managedServer.setListenPort(ssl_lp)
managedServer.setCluster(clus1)

save()
activate(block="true")
disconnect()
print 'End of script ...'
exit()
==============End cretaecluster.py file=======================
 
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

nothing looks wrong in your code. I've seen similar problem before if you don't have correct indentation. Problably you have a space or tab on line 2 before the word "from"
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That was indeed the problem. Good job seeing that despite the fact it wasn't visible in the post. -
    Bookmark Topic Watch Topic
  • New Topic