我在
linux发行版(Raspbian,Tomcat 7)上运行代码时遇到问题.该问题未出现在
Windows / Tomcat 7 /
Eclipse下的测试环境中:
我的webservice只返回HTTP 204而没有别的.该日志不包含请求期间发生错误的任何迹象.它应该像在测试环境中那样用json响应.
web.xml中
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
***
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp
**.useravailability.UserAvailabilityServletContextListener
REST Service
/REST/*
REST Service
com.sun.jersey.server.impl.container.servlet.ServletAdaptor
com.sun.jersey.api.json.POJOMappingFeature
true
1
usersService.xml
package **.webservice;
import java.util.ArrayList;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import com.google.gson.Gson;
import **.model.AccessManager;
@Path("/usersService")
public class UsersService {
@GET
@Produces("application/json")
public String getUser() {
String user = null;
ArrayList userList = new ArrayList();
try {
userList = new AccessManager().getUser();
Gson gson = new Gson();
user = gson.toJson(userList);
} catch (Exception e) {
e.printStackTrace();
}
return user;
}
}
我错过了什么?为什么它在测试环境中有效?
谢谢!