简体   繁体   English

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

[英]wsadmin: How to inspect existing resource references?

With $AdminApp view <applicationName> -MapResRefToEJB it is possible to list the resource references defined for a deployed EJB module. 使用$AdminApp view <applicationName> -MapResRefToEJB ,可以列出为已部署的EJB模块定义的资源引用。 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 (ie the resources references of an application) in a structured form using $AdminConfig? 是否可以使用$ AdminConfig以结构化形式获取相同信息(即应用程序的资源引用)?

The AppManagement MBean provides this data in a structured format (Vector of AppDeploymentTasks ). AppManagement MBean以结构化格式( AppDeploymentTasks Vector)提供此数据。 To obtain this data using wsadmin scripting ( jython ): 要使用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]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM