Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8613191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:48:44+00:00 2026-06-12T04:48:44+00:00

I am using Spring MVC with the Jackson Processor. When a JSON request is

  • 0

I am using Spring MVC with the Jackson Processor. When a JSON request is sent to the server as a POST request, the @RequestBody is being deserialized into the object that I need. The problem comes when the GET request is sent, it actually displays Http 500 Internal Server error. The exception that is thrown is:

java.io.EOFException: No content to map to Object due to end of input 
org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2022) 
org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:1974) 
org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1331) 
org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.readInternal  (MappingJacksonHttpMessageConverter.java:135) 
org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:154) 
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.readWithMessageConverters(HandlerMethodInvoker.java:633) 
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveRequestBody(HandlerMethodInvoker.java:597) 
 org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments  (HandlerMethodInvoker.java:346) 
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:171) 
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426) 
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414) 
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790) 
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) 
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) 
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:617) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 

No emtpy strings are sent and the correct JSON is sent to the server. I am not sure why this is happening. Below is my code:

JSP – index.jsp

<%@page language="java" contentType="text/html"%>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>  
<script type="text/javascript">
$(function() {  
$('#myForm').submit(function() { 
    var form = $( this ), 
        url = form.attr('action'), 
        userId = form.find('input[name="userId"]').val(),
        dat = JSON.stringify({ "userId" : userId }); 

    $.ajax({ 
        url : url, 
        type : "GET", 
        traditional : true, 
        contentType : "application/json", 
        dataType : "json", 
        data : dat, 
        success : function (response) { 
            alert('success ' + response); 
        }, 
        error : function (response) { 
            alert('error ' + response); 
        }, 
    }); 

    return false; 
   }); 
 }); 
</script>
</head>
<body>
<h2>Application</h2>
<form id="myForm" action="/application/user/find" method="GET">
    <input type="text" name="userId" value="user1">
    <input type="submit" value="Submit">
</form>
      </body>
</html>

As soon as I change the request type to POST in the JSP and the controller method everything seems to work correctly.

package com.web;

@Controller
@RequestMapping("/user/*")
public class UserController {

@RequestMapping(value = "find", method = RequestMethod.GET, headers = {"content-type=application/json"})
public @ResponseBody UserResponse save(@RequestBody User user) throws Exception {
    UserResponse userResponse = new UserResponse();
                System.out.println("UserId :" + " " + user.getUserId());
    return userResponse;
}

beans.xml

<context:component-scan base-package="com.web"/>

<mvc:annotation-driven/>

<context:annotation-config/>

User.java

public class User implements Serializable {

private String userId;

public User() {

}

// Getters and setters
}

When a GET request is sent the broswer usually displays %%user%%. This is only an example. Does the Jackson processor will still read GET requests?

I don’t know where the problem is. I hope you can help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:48:45+00:00Added an answer on June 12, 2026 at 4:48 am

    I read the following description on what the data parameter does in jQuey.ajax() does at http://api.jquery.com/jQuery.ajax/:

    Data to be sent to the server. It is converted to a query string, if not already a string. It’s appended to the url for GET-requests. ….

    So it is appended to the URL and there is no request body. That is a behaviour consistent with the GET semantics, if you want to post data use POST.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Spring MVC to handle JSON POST requests. Underneath the covers I'm using
Im using Spring MVC 3.1 which by default uses Jackson for JSON-Java conversions. I
Spring MVC + Jackson converting Java object to/from Json data. I want to validate
I'm having trouble getting Jackson to correctly deserialize json into an object when calling
I'm using Spring MVC v3.1.0 and HDIV (HTTP Data Integrity Validator) v2.1.0 as server-side
I'm using Spring MVC with Jackson. It requires <mvc:annotation-driven /> . It works with
Using Jackson, how can I have JSON serialized/deserialized by one application using one set
im using spring MVC and webflow to create a game server and serve some
I am using spring mvc in my application,when i created user i have to
I am using Spring MVC 3.1.x with Tiles 2.2.2 (bootstrapped project with Roo) and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.