掲示板
Getting NullPointerException when I post List of employees in jsonws
7年前 に Alex Man によって更新されました。
Getting NullPointerException when I post List of employees in jsonws
Junior Member 投稿: 70 参加年月日: 16/02/08 最新の投稿
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
7年前 に Juan Gonzalez によって更新されました。
Move to more appropiate category
Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Move to more appropiate category