0

I'm using apache api openmeetings. When i try to add a new user, I get HTTP Response Error 500 and the following error in the openmeetings log:

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)

this is my code:

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: "test@test.com",
          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);
    }
  });
}
Tore Usai
  • 3
  • 4

1 Answers1

0

OK, This is clearly bad design in OM 3.3.1 :(

Both user and confirm parameters are annotated as @QueryParam (should be @FormParam)

So you have to call it as follows:

$.ajax({
method: "POST",
url: "http://localhost:5080/openmeetings/services/user?sid=28647b3d-ffe2-4c1b-9835-9856b6c3d11b&user=" + escape(JSON.stringify({
    address: {
      country: "IT",
      email: "test@test.com"
    },
    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);
}
});

This is ugly and will be definitely fixed in 3.3.2+

Here is the JIRA: https://issues.apache.org/jira/browse/OPENMEETINGS-1693

  • Still not working... ERROR 09-06 14:03:31.591 244399 230 o.a.o.w.UserWebService [0.0-5080-exec-1] - addNewUser java.lang.NullPointerException: null at org.apache.openmeetings.db.dto.user.UserDTO.get(UserDTO.java:75) at org.apache.openmeetings.webservice.UserWebService.add(UserWebService.java:189) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) – Tore Usai Sep 06 '17 at 12:03
  • You have to change request: 1) remove all IDs 2) set unique login 3) change password so it will not contain user login/first/last name/email. I'll try to improve error reporting – Maxim Solodovnik Sep 06 '17 at 13:09