wsadmin:如何检查现有资源引用?

发布于 2024-12-17 08:16:24 字数 208 浏览 2 评论 0原文

使用 $AdminApp 查看-MapResRefToEJB 可以列出为已部署的 EJB 模块定义的资源引用。但是,该命令的结果是纯文本(此外还可以进行本地化)。要提取该信息,就必须解析该文本,这不是很方便。有没有办法使用 $AdminConfig 以结构化形式获取相同的信息(即应用程序的资源引用)?

With $AdminApp view <applicationName> -MapResRefToEJB it is possible to list the resource references defined for a deployed EJB module. However, the result of that command is plain text (that in addition may be localized). To extract that information one would have to parse this text, which is not very convenient. Is there a way to get the same information (i.e. the resources references of an application) in a structured form using $AdminConfig?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我很坚强 2024-12-24 08:16:24

AppManagement MBean 以结构化格式提供此数据(AppDeploymentTasks)。要使用 wsadmin 脚本 (jython) 获取此数据:

import javax.management as mgmt
appName = sys.argv[0]
appMgmt = mgmt.ObjectName(AdminControl.completeObjectName("WebSphere:*,type=AppManagement"))
appInfo = AdminControl.invoke_jmx(appMgmt, "getApplicationInfo", [appName, java.util.Hashtable(), None], ["java.lang.String", "java.util.Hashtable", "java.lang.String"])
for task in appInfo :
    if (task.getName() == "MapResRefToEJB") :
        resRefs = task.getTaskData()
        # skip the first row since it contains the headers
        for i in range(1, len(resRefs)) :
            resRef = resRefs[i]
            print
            print "URI:", resRef[4]
            print "EJB:", resRef[3]
            print "Name:", resRef[5]
            print "Type:", resRef[6]
            print "JNDI:", resRef[8]

The AppManagement MBean provides this data in a structured format (Vector of AppDeploymentTasks). To obtain this data using wsadmin scripting (jython):

import javax.management as mgmt
appName = sys.argv[0]
appMgmt = mgmt.ObjectName(AdminControl.completeObjectName("WebSphere:*,type=AppManagement"))
appInfo = AdminControl.invoke_jmx(appMgmt, "getApplicationInfo", [appName, java.util.Hashtable(), None], ["java.lang.String", "java.util.Hashtable", "java.lang.String"])
for task in appInfo :
    if (task.getName() == "MapResRefToEJB") :
        resRefs = task.getTaskData()
        # skip the first row since it contains the headers
        for i in range(1, len(resRefs)) :
            resRef = resRefs[i]
            print
            print "URI:", resRef[4]
            print "EJB:", resRef[3]
            print "Name:", resRef[5]
            print "Type:", resRef[6]
            print "JNDI:", resRef[8]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文