2017-09-06 66 views
1

我正在使用apache api openmeetings。當我嘗試添加一個新用戶,我得到的HTTP響應錯誤500,並在openmeetings以下錯誤日誌:通過Ajax在apache openmeetings API中添加新用戶不起作用

ERROR 09-06 11:18:00.938 22023 230 o.a.o.w.UserWebService [0.0-5080-exec-2] - addNewUser 
java.lang.NullPointerException: null 
     at org.apache.openmeetings.webservice.UserWebService.add(UserWebService.java:171) 

這是我的代碼:

function create_user() { 

    $.ajax({ 
    method: "POST", 
    url: "http://localhost:5080/openmeetings/services/user?sid=28647b3d-ffe2-4c1b-9835-9856b6c3d11b", 
    data: { 
     user: JSON.stringify({ 
     address: { 
      country: "IT", 
      deleted: false, 
      email: "[email protected]", 
      id: "2" 
     }, 
     externalId: "1", 
     externalType: "myCMS", 
     firstname: "Test", 
     id: "2", 
     languageId: "5", 
     lastname: "Prova", 
     login: "Test", 
     password: "Prova1*", 
     rights: null, 
     timeZoneId: "Europe/Rome", 
     type: "user" 
     }), 
     confirm: false 
    }, 
    dataType: "json", 
    success: function(data) { 
     consol.log(data); 
    } 
    }); 
} 
+0

你好,你使用的是什麼版本的OM?行號171對3.3.0和3.3.1似乎沒用::( –

+0

我使用的是版本3.3.1 –

+0

你能否提供更大的堆棧跟蹤? –

回答

0

OK,這顯然是糟糕的設計在OM 3.3.1 :(

兩個userconfirm參數註釋爲@QueryParam(應該是@FormParam

所以ÿ OU必須調用它,如下所示:

$.ajax({ 
method: "POST", 
url: "http://localhost:5080/openmeetings/services/user?sid=28647b3d-ffe2-4c1b-9835-9856b6c3d11b&user=" + escape(JSON.stringify({ 
    address: { 
     country: "IT", 
     email: "[email protected]" 
    }, 
    externalId: "1", 
    externalType: "myCMS", 
    firstname: "Test", 
    languageId: "5", 
    lastname: "Prova", 
    login: "testX879", 
    password: "ACDfium1*", 
    timeZoneId: "Europe/Rome", 
    type: "user" 
    })) + '&confirm=false', 
data: {}, 
dataType: "json", 
success: function(data) { 
    consol.log(data); 
} 
}); 

這是醜陋的,將被明確地固定於3.3.2+

這裏是JIRA:https://issues.apache.org/jira/browse/OPENMEETINGS-1693

+0

仍然沒有工作... ERROR 09-06 14:03:31.591 244399 230 oaowUserWebService [0.0-5080-exec-1] - addNewUser java.lang.NullPointerException:null at org.apache.openmeetings.db.dto.user.UserDTO.get( UserDTO.java:75) 在org.apache.openmeetings.webservice.UserWebService.add(UserWebService.java:189) 在sun.reflect.NativeMethodAccessorImpl.invoke0(本機方法) 在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl .java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet hodAccessorImpl.java:43) –

+0

您必須更改請求:1)刪除所有ID 2)設置唯一登錄3)更改密碼,使其不包含用戶登錄/第一/姓/電子郵件。我會盡力改進錯誤報告 –

+0

它的工作原理。謝謝 –

相關問題