无法发布请求,收到错误 - java.io.IOException:写入服务器时出错

时间:2016-09-16 08:08:31

标签: java rest tomcat tomcat6

我有一个REST方法,它将获取域的配置文件(它是XML格式并且有超过20K行)。 当我在Tomcat中执行此Rest调用时,我遇到错误:

com.sun.jersey.api.client.ClientHandlerException: java.io.IOException: Error writing to server
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:151)
at com.sun.jersey.api.client.Client.handle(Client.java:648)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:680)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:558)
at com.verizon.vzips.util.RestClientUtil.fetchDataFromServer(RestClientUtil.java:95)
at com.verizon.vzips.servlet.VZIPSServlet.doPost(VZIPSServlet.java:126)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.verizon.vzips.filter.SessionFilter.doFilter(SessionFilter.java:111)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:612)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:503)
at java.lang.Thread.run(Unknown Source)

以下是休息电话的代码:

@POST
    @Path("/updateConfigFiles")
    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
    @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
    public Response updateConfigFiles(@Context HttpServletRequest req) {
        super.request = req;
        logger.info("performing updateConfigFiles");
        DataSourceCriteria criteria = new DataSourceCriteria();
        setUserIdUserTypeToCriteria(req, criteria);
        final Status responseStatus = Status.OK;
        ConfigHolder configHolder=new ConfigHolder();
        String type = request.getParameter("type");
        //String configData = request.getParameter("order");

        //System.out.println(configData);

        configHolder.setOrderId(request.getParameter("order"));
        configHolder.setService(request.getParameter("service"));
        if ("Pre".equals(type)) {
            configHolder.setBootStrapConfig(request.getParameter("order"));
        } else {
            configHolder.setDomainConfig(request.getParameter("order"));
        }
        try{
        DBConnectionUtils.updateConfigFiles(configHolder);

        } catch (final Exception e) {
        logger.error("Error in updateConfigFiles"
                + e.getMessage());
        final String errorMessage = processExceptions(e, userProfile);
        return Response.status(Status.INTERNAL_SERVER_ERROR)
                .entity(errorMessage).build();
    }

    return Response
            .status(responseStatus)
            .build();

}

我已将maxPostsizemaxHeadersize添加到server.xml中,但仍然出现上述错误。

是否有针对此问题的替代解决方案/修复程序。 我尝试过所有可能的解决方案,但没有成功。

0 个答案:

没有答案