1

I'm making a web application that send large amount of data in report processing in spring mvc framework with tomcat server. What i encounter is that when the transaction is about 300 rows, it's not sending at all.Here is my controller:

@RequestMapping(value = "/save",method=RequestMethod.POST)
public @ResponseBody  String saveForm(AbtractForm form,
        HttpServletRequest request,  BindingResult result){
    String returnText="";
    if(!result.hasErrors()){
        try{
            servicesInterface.saveFormImpl(form);
            returnText = "ENTRY HAS BEEN SAVED";
        }catch(Exception ex){
            ex.printStackTrace();
            System.out.println("Info log:"+ex.getMessage());
            returnText = "INVALID ENTRY.CHECK LOG FOR MORE INFORMATION.";
        }
    }else{
    returnText = "INVALID ENTRY.CHECK LOG FOR MORE INFORMATION.";
    }
    return returnText;
}

This is the configuration of tomcat server.xml

<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" maxPostSize="-1" />

This is my ajax function to send data:

$.ajax({ 
    type: 'POST',
    dataType:'JSON',
    url: '/save',                        
    data:$("#formID").serialize(),
    async:false,
    success:function(response){
        if(response == "ENTRY HAS BEEN SAVED"){
           $('#dataTable tbody tr').text("");
           $("#done").attr("class","success");                                      
        }else{
           $("#done").attr("class","error");                                                                            
        } 
        $("#load").hide();                  
        $("#spanMessage").text(response);           
    },
    error:function(er,st,th){                                       
        $("#spanMessage").text("ERROR FOUND");   
        $("#load").hide();                                          
    },
});

Tomact server configuration for maxPostSize is already set to -1(unlimited post max size)but its not working.When i send data less 200 rows, it works perfectly. I have an array element for the transaction (table rows). This is the error i found:

Request Method:POST
Status Code:404 Not Found

The request headers:

Accept:*/*
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:149602
Content-Type:application/x-www-form-urlencoded; charset=UTF-8
Cookie:JSESSIONID=F6CF1C8FBC8144F94F50F0BC329E3C70

The response headers:

Cache-Control:no-cache
Cache-Control:no-store
Content-Language:en-US
Pragma:no-cache
Server:Apache-Coyote/1.1
Transfer-Encoding:chunked

My controller is not throwing me an error in log.But when i send data in small amount, the controller is responding with successfully save. Is there another way to configure the limit size of tomcat server?

thanks.

chi
  • 11
  • 3
  • make sure the url (`/save`) used in ajax is correct. `if(response == "ENTRY HAS BEEN SAVED"){` - why should you use such a string instead of 0 or 1 to check success. – Istiaque Ahmed Jan 14 '15 at 03:02
  • @IstiaqueAhmed the url(/save) ajax is correct because when i send data less 200 transaction or rows, it works and it saved. But when have i have a transaction more than 300 rows, and that's the time error is throwing. – chi Jan 14 '15 at 03:47
  • `404 not found` means the file is not there or the `url` is not defined. – Istiaque Ahmed Jan 14 '15 at 04:03
  • @IstiaqueAhmed when i'm sending 200 rows transaction, then it works perfectly. but when the rows transaction is more than 300, i got the error 404 not found. - thanks.. – chi Jan 14 '15 at 06:42
  • any help from here - http://stackoverflow.com/questions/4387121/application-succesfully-deployed-on-tomcat-but-404-error ? – Istiaque Ahmed Jan 14 '15 at 13:57
  • http://tinyurl.com/l7m63vc and especially http://www.coderanch.com/forums/posts/list/40/87666 – Istiaque Ahmed Jan 14 '15 at 14:04
  • Which version of tomcat are you using? and maybe post the relevant parts from context.xml / server.xml ... – alfonx Jan 13 '17 at 23:36

0 Answers0