Fórum
Getting NullPointerException when I post List of employees in jsonws
Alex Man, modificado 7 Anos atrás.
Getting NullPointerException when I post List of employees in jsonws
Junior Member Postagens: 70 Data de Entrada: 08/02/16 Postagens Recentes
I have created a service builder for a Employee entity which has three fields name, id and place. Further I have created addEmployees in EmployeeServiceImpl.java to invoke a json-web-services to add employees.
The addEmployees code is as given below
My json-web-services for adding employees is given below
to which I have passed the following json array of employee details
When I trigger the above POST rest call I am getting NullPointerException like as shown below
Can anyone please tell me some solution for this
The addEmployees code is as given below
public class EmployeeServiceImpl extends EmployeeServiceBaseImpl {
public void addEmployees(List<employee> employees) throws SystemException {
for(Employee employee: employees)
{
try {
EmployeeLocalServiceUtil.addEmployees(employee);
} catch (SystemException e) {
e.printStackTrace();
throw e;
}
}
}
}
</employee>
My json-web-services for adding employees is given below
http://localhost:8080/api/jsonws/employee-portlet.employees/add-employees/-employees
to which I have passed the following json array of employee details
[
{
"name": "Manu",
"id": 123,
"place": "ABCS"
},
{
"name": "John",
"id": 124,
"place": "BCFS"
}
]
When I trigger the above POST rest call I am getting NullPointerException like as shown below
{"message":"java.lang.NullPointerException","exception":"java.lang.NullPointerException"}
Can anyone please tell me some solution for this
Juan Gonzalez, modificado 7 Anos atrás.
Move to more appropiate category
Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
Move to more appropiate category