【问题标题】:weblogic wlst findService NameErrorweblogic wlst findService NameError
【发布时间】:2014-03-28 13:57:35
【问题描述】:

我有以下 wlst 脚本:

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)

结果是错误:

wls:/offline> execfile('C:\script.py') Traceback(最里面最后一个):
文件“”,第 1 行,在?文件“C:\script.py”,第 31 行,在 ?
文件“C:\script.py”,第 22 行,在获取 SessionManagementMBean NameError: findService

我该如何解决这个问题?

【问题讨论】:

  • 可能是您正在执行脚本/模块的错误部分

标签: weblogic wlst


【解决方案1】:

您是否曾经连接到您的服务器并访问域运行时?您应该执行以下操作:

connect("weblogic", "weblogic", "t3://localhost:7001")
domainRuntime()

# obtain session management mbean to create a session.
# This mbean instance can be used more than once to
# create/discard/commit many sessions
sessionMBean = findService(SessionManagementMBean.NAME,SessionManagementMBean.TYPE)

在这里查看更多:

http://docs.oracle.com/cd/E13171_01/alsb/docs25/javadoc/com/bea/wli/sb/management/configuration/SessionManagementMBean.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-23
    • 1970-01-01
    相关资源
    最近更新 更多