首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >weblogic wlst findService NameError

weblogic wlst findService NameError
EN

Stack Overflow用户
提问于 2014-03-28 13:57:35
回答 1查看 2.1K关注 0票数 0

我有以下wlst脚本:

代码语言:javascript
复制
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:/脱机> execfile('C:\script.py')回溯(最里面的最后一个): 文件"",第1行,在?文件"C:\script.py",第31行,在? 文件"C:\script.py",第22行,在get SessionManagementMBean NameError: findService中

我怎么才能解决这个问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-03-28 18:03:10

您是否曾经连接到服务器并访问域运行时?你应该做如下的事情:

代码语言:javascript
复制
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)

在这里见更多:

01/alsb/docs25/javadoc/com/bea/wli/sb/management/configuration/SessionManagementMBean.html

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22714890

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档