鍍金池/ 問答/Java  Linux  HTML/ Web Service調(diào)用WebLogic Server MBean失敗。

Web Service調(diào)用WebLogic Server MBean失敗。

問題描述

調(diào)用Web Service時出現(xiàn)錯誤:

Client received SOAP Fault from server : Failed to retrieve RMIServer stub: javax.naming.NoPermissionException: User <anonymous> does not have permission on weblogic.management.mbeanservers to perform lookup operation.

問題出現(xiàn)的環(huán)境背景及自己嘗試過哪些方法

參考How it’s done: Password change functionality in OBIEE
Weblogic域安全屬性“啟用匿名管理員查找”已打鉤。
相關(guān)服務(wù)器協(xié)議IIOP屬性“啟用 IIOP”已打鉤。IIOP登錄用戶名密碼已設(shè)置。
本地測試和直接部署測試都是遇到這個錯誤。

你期待的結(jié)果是什么?實際看到的錯誤信息又是什么?

是不是Weblogic還需要做額外的設(shè)置?

回答
編輯回答
臭榴蓮

修改初始化連接方法:

    public static void InlCctn(String Adr, String AdrUsr, String AdrPswd) throws IOException, MalformedURLException {
        JMXServiceURL SvcUrl =
            new JMXServiceURL("service:jmx:iiop://" + Adr + "/jndi/weblogic.management.mbeanservers.domainruntime");
        Hashtable h = new Hashtable();
        h.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
        h.put(Context.SECURITY_PRINCIPAL, AdrUsr);
        h.put(Context.SECURITY_CREDENTIALS, AdrPswd);
        cctor = JMXConnectorFactory.connect(SvcUrl, h);
        mbsc = cctor.getMBeanServerConnection();
    }
2017年3月11日 09:49