This discussion is archived
3 Replies Latest reply: Feb 5, 2013 8:44 AM by MarianoP76 RSS

WLST connect(username,pwd,url) throws StringIndexOutOfBoundsException

985395 Newbie
Currently Being Moderated
connect(str(self.username),str(self.password),url) throws StringIndexOutOfBoundsException: String index out of range: -2. When executed from a thread.

*.PY code used*
class ThreadingClass(threading.Thread):
object_lock = Lock()

def __init__(self, username,password,serverlist,failedDS,domain):
threading.Thread.__init__(self)
self.serverlist = serverlist
self.username = username
self.password = password
self.failedDS = failedDS
self.domain = domain

def run(self):
for b in self.serverlist:
host = b.getHost()
port = b.getPort()
servername = b.getName()
url = "t3://" + host+":"+str(port)
try:
connect(str(self.username),str(self.password),url)
serverRuntime()
dsMBeans = cmo.getJDBCServiceRuntime().getJDBCDataSourceRuntimeMBeans()
for ds in dsMBeans:
s = str(ds.testPool())
print '****Debug***'+s
if not 'None' in s:
ThreadingClass.object_lock.acquire()
lt = []
if self.domain in self.failedDS:
lt=self.failedDS[self.domain]
lt.append(ds.getName())
else:
lt=[ds.getName()]
self.failedDS[self.domain] = lt
ThreadingClass.object_lock.release()
disconnect()
except:
print "Server status:"+servername+",SHUTDOWN"

Complete Stack trace of Exception._
java.lang.StringIndexOutOfBoundsException: String index out of range: -2[[
at java.lang.String.substring(String.java:1937)
at weblogic.management.scripting.WLSTUtils.getListenAddress(WLSTUtils.java:148)
at weblogic.management.scripting.WLSTHelper.lookupMBeanServerConnection(WLSTHelper.java:658)
at weblogic.management.scripting.WLSTHelper.initDomainRuntimeServerConnection(WLSTHelper.java:434)
at weblogic.management.scripting.WLSTHelper.initConnections(WLSTHelper.java:319)
at weblogic.management.scripting.WLSTHelper.connect(WLSTHelper.java:203)
at weblogic.management.scripting.WLScriptContext.connect(WLScriptContext.java:62)
at weblogic.management.scripting.utils.WLSTUtil.initializeOnlineWLST(WLSTUtil.java:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.python.core.PyReflectedFunction.__call__(Unknown Source)
at org.python.core.PyMethod.__call__(Unknown Source)
at org.python.core.PyObject.__call__(Unknown Source)
at org.python.core.PyObject.invoke(Unknown Source)
at org.python.pycode._pyx4.connect$1(<iostream>:16)
at org.python.pycode._pyx4.call_function(<iostream>)
at org.python.core.PyTableCode.call(Unknown Source)
at org.python.core.PyTableCode.call(Unknown Source)
at org.python.core.PyTableCode.call(Unknown Source)
at org.python.core.PyFunction.__call__(Unknown Source)
at org.python.pycode._pyx47.run$8(/debug/wlstCommand5829503504103394409.py:43)
at org.python.pycode._pyx47.call_function(/debug/wlstCommand5829503504103394409.py)
at org.python.core.PyTableCode.call(Unknown Source)
at org.python.core.PyTableCode.call(Unknown Source)
at org.python.core.PyFunction.__call__(Unknown Source)
at org.python.core.PyInstance.invoke(Unknown Source)
at threading$py._Thread__bootstrap$49(C:\wlst\jython_2.2.1\Lib\threading.py:414)


Few other errors in logs._
The CompatabilityMBeanServer is not initialized properly.
This might happen if the CompatabilityMBeanServer is
disabled via the JMXMBean.

WLST detected that the DomainRuntimeMBeanServer is not enabled
or not initialized properly. This might happen if the
DomainRuntimeMBeanServer is disabled via the JMXMBean. Please
ensure that this MBeanServer is enabled. Online WLST cannot
function without this MBeanServer.

Code to invoke_
for x in domainServers.keys():
thread1 = ThreadingClass(Username,''.join(Password),domainServers[x],failedDS,x)
thread1.start()

for thread in threading.enumerate():
try:
if thread is not threading.currentThread():
thread.join()
except:
print 'exception occured'

Please help. Thanks in advance.

Edited by: 982392 on Feb 1, 2013 8:46 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points