简体   繁体   中英

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. 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?

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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