title: weblogic wlst findService NameError
body: <p>I have the following wlst script:</p>
  
  <pre><code>import wlstModule
  from com.bea.wli.sb.management.configuration import SessionManagementMBean
  from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
  from com.bea.wli.config import Ref
  
  #=======================================================================================
  # Utility function to read a binary file
  #=======================================================================================
  def readBinaryFile(fileName):
      file = open(fileName, 'rb')
      bytes = file.read()
      return bytes
  
  #=======================================================================================
  # Utility function to create an arbitrary session name
  #=======================================================================================
  def createSessionName():
      sessionName = String("SessionScript"+Long(System.currentTimeMillis()).toString())
      return sessionName
  
  def getSessionManagementMBean(sessionName):
      SessionMBean = findService("SessionManagement", "com.bea.wli.sb.management.configuration.SessionManagementMBean")
      SessionMBean.createSession(sessionName)
      return SessionMBean
  
  
  SessionMBean = None 
  importJar='C:\\OSB_PROJECT.jar'
  theBytes = readBinaryFile(importJar)
  sessionName = createSessionName()
  SessionMBean = getSessionManagementMBean(sessionName)
  </code></pre>
  
  <p>The result is an error:</p>
  
  <blockquote>
    <p>wls:/offline> execfile('C:\script.py') Traceback (innermost last):<br>
    File "", line 1, in ?   File "C:\script.py", line 31, in ?<br>
    File "C:\script.py", line 22, in get SessionManagementMBean
    NameError: findService </p>
  </blockquote>
  
  <p>How can I fix this?</p>