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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:17:03+00:00 2026-06-16T03:17:03+00:00

After upgrading my Spring MVC application to Spring 3.2 I’m getting the following exception

  • 0

After upgrading my Spring MVC application to Spring 3.2 I’m getting the following exception when accessing some of my URLs:

org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
    at org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.handleNoMatch(RequestMappingInfoHandlerMapping.java:203) ~[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.lookupHandlerMethod(AbstractHandlerMethodMapping.java:272) ~[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:212) ~[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:55) ~[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    at org.springframework.web.servlet.handler.AbstractHandlerMapping.getHandler(AbstractHandlerMapping.java:297) ~[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1091) ~[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1076) ~[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:896) ~[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) ~[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:915) [spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE]
(...)

This exception results to a HTTP 406 NOT ACCEPTABLE.

I’ve managed to create a simplified controller with a URL I cannot access:

@RequestMapping(value = "/resources/foo.js", produces = "text/javascript")
@ResponseBody
public String foo() throws Exception {
    return "";
}

As I’m using a normal browser which has */* in the Accept-header, I don’t see why I should get a HTTP 406. What makes this even more strange is that this code is working with Spring 3.1.2, but not with Spring 3.2. Why is that?

  • 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-16T03:17:04+00:00Added an answer on June 16, 2026 at 3:17 am

    There have been several changes related to how Spring does content-negotiations in 3.2. One of these changes is that content negotiations can now be done based on the file suffix in the URL. This feature is enabled by default. In Spring versions prior to 3.2 the HTTP accept-header were used for content-negotiations. When browsers accessed your URLs content-negotiation was seldom an issue, as browser always sends Accept:(...)*/*.

    Spring has a map of suffix => Media type. For “.js” the default media type is “application/x-javascript”. When Spring tries to lookup the handler mapping for a request to /resources/foo.js, it won’t match your foo()-method as it produces the wrong media type.

    I’m not sure if the Spring team has thought through this case. It is at least a bit strange that it lets you create a @RequestMapping which cannot be accessed (because of the incompatibility between the .js-media type and what is set in the produces field).

    There are several ways of fixing this issue. One is to change the produces-parameter to “application/x-javascript”. Another would be to change the media type of “.js” to “text/javascript” (see the docs of how to do that). A third possibility is to turn off content-negotiations based on suffixes (again, see the docs of how to do it).

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

Sidebar

Related Questions

after upgrading from grails 1.3.7 to 2.0.1 i'm getting follwong strange exception when validating
After upgrading to MVC 3 RTM I get an exception where it previously worked.
I'm writing web application that uses Spring MVC to bind Spring beans with REST-like
After upgrading from Spring 3.0.0.M4 to 3.0.0.RC1 and Spring Security 3.0.0.M2 to 3.0.0.RC1, I've
I encountered the following problem after upgrading to the latest version 1.8.1 of data.table
We are getting this error after upgrading to NHibernate 2.1. [QueryException: Cannot simultaneously fetch
After upgrading to the iPhone SDK 4.0, I get the following error when building
So I keep getting the Application is busy RPC_E_SERVERCALL_RETRYLATER error with the following code.
When using hibernate 3, the following code works: <bean id=ivsHibernateWriter class=org.springframework.batch.item.database.HibernateItemWriter> <property name=hibernateTemplate ref=hibernateTemplate/>
I've just tested locally my web application, everything works fine, but after uploading to

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.