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 3959628
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:45:12+00:00 2026-05-20T02:45:12+00:00

From what I understand, if you’re using the mvc:annotation-driven tag, then you can pass

  • 0

From what I understand, if you’re using the mvc:annotation-driven tag, then you can pass back JSON formatted objects, provided that the relevant jackson jar files are present in the classpath. This is the case.

However, I’m getting a 406 (not acceptable) response from the server.

here’s the relevant section from the annotated controller:

@RequestMapping(value = "/{groupEventUID}/{attendeeId}/update2.htm", method = RequestMethod.POST)
public
@ResponseBody
DateResponse submitDate2(@PathVariable String groupEventUID, @PathVariable int attendeeId, ModelMap model) {
    return new DateResponse();
}

This is the jquery code on the client page:

    <script type="text/JavaScript"> 
        $(document).ready(function(){
            $(".dayblock").click(function(){
                $(event.target).css('background-color','green');

                $.ajax({
                    url: "update2.htm",
                    type: "POST",
                    dataType: "json",
                    success: function(data){
                        alert("Data Loaded: " + data);
                    }
                }); 
            });
        });
    </script> 

The jackson jars that I’ve tried placing in the classpath are:

jackson-core-asl-1.7.2.jar and jackson-mapper-asl-1.7.2.jar

I also tried

jackson-all-1.7.2.jar

still getting the dreaded 406..

Does the DateResponse object need to be explicitly annotated to convert it to JSON? I would have thought that using the existing field names would be the default behaviour.

I think the most frustrating thing is that I can’t see any back end exceptions, so I’m resorting to trial and error.

EDIT: Here are the http headers

Request URL:http://localhost:8080/7uid/5/update2.htm
Request Method:POST
Status Code:406 Not Acceptable

Request Headers

Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-GB,en-US;q=0.8,en;q=0.6
Connection:keep-alive
Content-Length:0
Cookie:JSESSIONID=C8B515F9BE0773BF7916E3FA7F17EE30
Host:localhost:8080
Origin:http://localhost:8080
Referer:http://localhost:8080/7uid/5/showAttendeeCalendar.htm
User-Agent:Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.84 Safari/534.13
accept:application/json, text/javascript, */*; q=0.01
x-requested-with:XMLHttpRequest

Response Headers

Cache-Control:no-cache
no-store
Content-Length:1070
Content-Type:text/html;charset=utf-8
Date:Mon, 07 Feb 2011 16:31:03 GMT
Expires:Thu, 01 Jan 1970 00:00:00 GMT
Pragma:no-cache
Server:Apache-Coyote/1.1

And here is the dispatcher-servlet.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
       http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd" >


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


    <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>
    <bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />

    <!--
    Most controllers will use the ControllerClassNameHandlerMapping above, but
    for the index controller we are using ParameterizableViewController, so we must
    define an explicit mapping for it.
    -->
    <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <props>
                <prop key="index.htm">indexController</prop>
            </props>
        </property>
    </bean>


    <!--
    The index controller.
    -->
    <bean name="indexController"
          class="org.springframework.web.servlet.mvc.ParameterizableViewController"
          p:viewName="index" />


    <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />


    <bean id="emf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="loadTimeWeaver">
            <bean class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver"/>
        </property>
    </bean>


    <bean id="myTxManager"
     class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="emf"/>
    </bean>

    <tx:annotation-driven transaction-manager="myTxManager" />


    <bean id="jacksonMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"></bean>
    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
        <property name="messageConverters">
            <list>
                <ref bean="jacksonMessageConverter"/>
            </list>
        </property>
    </bean>

    <mvc:annotation-driven/>

    <bean id="viewResolver"
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"
          p:prefix="/WEB-INF/jsp/"
          p:suffix=".jsp" />


</beans>

EDIT2: here’s the catalina.out

07-Feb-2011 17:05:46 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /opt/java/jdk1.6.0_21/jre/lib/amd64/server:/opt/java/jdk1.6.0_21/jre/lib/amd64:/opt/java/jdk1.6.0_21/jre/../lib/$
07-Feb-2011 17:05:46 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
07-Feb-2011 17:05:46 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 786 ms
07-Feb-2011 17:05:46 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
07-Feb-2011 17:05:46 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
07-Feb-2011 17:05:46 org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor host-manager.xml
07-Feb-2011 17:05:46 org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor ROOT.xml
07-Feb-2011 17:05:47 org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
07-Feb-2011 17:05:47 org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Mon Feb 07 17:05:47 GMT 2011]; root of context hierarchy
07-Feb-2011 17:05:47 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
07-Feb-2011 17:05:47 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3cc70b0d: defining beans []; root of factory hierarchy
07-Feb-2011 17:05:47 org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 329 ms
07-Feb-2011 17:05:47 org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'dispatcher': initialization started
07-Feb-2011 17:05:47 org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Mon Feb 07 17:05:47 GMT 2011]; parent: Root WebApplicationContext
07-Feb-2011 17:05:47 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
07-Feb-2011 17:05:48 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@228b677f: defining beans [mainController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annot$
07-Feb-2011 17:05:48 org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean createNativeEntityManagerFactory
INFO: Building JPA container EntityManagerFactory for persistence unit 'NightOutPU'
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/main] onto handler [com.crowdbot.nightout.web.MainController@41a7c484]
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/main/*] onto handler [com.crowdbot.nightout.web.MainController@41a7c484]
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/index.htm] onto handler [org.springframework.web.servlet.mvc.ParameterizableViewController@4d3af084]
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/addEditGroupEvent.htm] onto handler [com.crowdbot.nightout.web.MainController@41a7c484]
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/groupEventSuccess.htm] onto handler [com.crowdbot.nightout.web.MainController@41a7c484]
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/{groupEventUID}/addEditAttendee.htm] onto handler [com.crowdbot.nightout.web.MainController@41a7c484]
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/{groupEventUID}/showAttendees.htm] onto handler [com.crowdbot.nightout.web.MainController@41a7c484]
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/{groupEventUID}/{attendeeId}/showAttendeeCalendar.htm] onto handler [com.crowdbot.nightout.web.MainController@41a7c484]
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/{groupEventUID}/{attendeeId}/update.htm] onto handler [com.crowdbot.nightout.web.MainController@41a7c484]
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/{groupEventUID}/{attendeeId}/update2.htm] onto handler [com.crowdbot.nightout.web.MainController@41a7c484]
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/addEditGroupEvent.htm] onto handler [com.crowdbot.nightout.web.MainController@41a7c484]
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/groupEventSuccess.htm] onto handler [com.crowdbot.nightout.web.MainController@41a7c484]
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/{groupEventUID}/addEditAttendee.htm] onto handler [com.crowdbot.nightout.web.MainController@41a7c484]
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/{groupEventUID}/showAttendees.htm] onto handler [com.crowdbot.nightout.web.MainController@41a7c484]
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/{groupEventUID}/{attendeeId}/showAttendeeCalendar.htm] onto handler [com.crowdbot.nightout.web.MainController@41a7c484]
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/{groupEventUID}/{attendeeId}/update.htm] onto handler [com.crowdbot.nightout.web.MainController@41a7c484]
07-Feb-2011 17:05:49 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/{groupEventUID}/{attendeeId}/update2.htm] onto handler [com.crowdbot.nightout.web.MainController@41a7c484]
07-Feb-2011 17:05:49 org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'dispatcher': initialization completed in 1909 ms
07-Feb-2011 17:05:49 org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
07-Feb-2011 17:05:49 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
07-Feb-2011 17:05:49 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
07-Feb-2011 17:05:49 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080

and here’s the localhost log for the same period:

07-Feb-2011 17:05:47 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
07-Feb-2011 17:05:47 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'dispatcher'
07-Feb-2011 17:05:49 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
07-Feb-2011 17:05:49 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
  • 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-05-20T02:45:13+00:00Added an answer on May 20, 2026 at 2:45 am

    OK, it’s fixed.

    The issue lies in the fact I’d already registered a DefaultAnnotationHadlerMapping, and a AnnotationMethodHandlerAdapter. I suspect that these clash with the beans set up by the tag. I think this is what happens when you try to blend together a bunch of different tutorials!

    Commenting them out fixes the problem.

    <!--<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" /> -->
    <!-- <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /> -->
    

    Thanks for the assistance everyone!

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

Sidebar

Related Questions

I am working on an ASP.NET MVC application and using jQuery. I understand from
I can very well understand from this Selectutorial what element/tag based descendant selectors are,
I am using DBus in a project. I understand from DBus specification that for
I understand from this post that value types in C# are not objects. That
As fas as I understand from here Can Android App be embedded in Web
I am experiencing several issues that I can't understand from the first glances. The
I am trying to understand from this example if lubridate can be applied to
I need to return an array of class objects from a function. I understand
I am using ASP.NET MVC application. However I am not able to understand the
I found that Maven implies specific directory layout. But I don't understand from here:

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.