2016-05-09 33 views
1

我在使用wlst時有一個關於從java獲取角色的過程。 我的代碼如下:由java執行OBIEE wlst命令

import weblogic.management.scripting.WLST; 
import weblogic.management.scripting.utils.WLSTInterpreter; 
public class JavaTestWLST { 
    public JavaTestWLST() { 

    }  
    public static void main(String[] args) { 
     try { 
      WLST.ensureInterpreter(); 
      WLSTInterpreter interpreter = WLST.getWLSTInterpreter();       
      interpreter.exec("connect('admin','admin','t3://server:7001')");       
      interpreter.exec("listAppRoles('obi')");  
      //or interpreter.exec("listAppRoles(appStripe='obi')"); 
      //still eror NameError: listAppRole 

     } 
     catch(Exception e){ 
      System.out.println("Exception_111:"+e.toString());   
     } 
    } 
} 

我sussessfully連接,但有一個錯誤。 錯誤: 例外:回溯(最裏面的最後一個): 文件「」,第1行,在? NameError:listAppRoles

請幫我 謝謝。

+0

感謝您的答案,interpreter.exec更換( 「listAppRoles(appStripe = '腰帶')」 後, );我仍然有同樣的錯誤,因爲befor。我不知道爲什麼?請幫幫我。謝謝 – HoangThu

回答

0

您正在調用此函數模塊將採用HashMap對象(鍵,值對)。該鑰匙必須通過鑰匙。像這樣listAppRoles(appStripe = 「APPNAME」) 您的代碼行可能會發生相應的變化,如下圖所示:

interpreter.exec("listAppRoles(appStripe='obi')"); 
+0

感謝您的回答,更換後由interpreter.exec(「listAppRoles(appStripe ='obi')」);我仍然有同樣的錯誤,因爲befor。我不知道爲什麼?請幫幫我。謝謝 – HoangThu