• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

java.lang.ClassCastException: ParameterizableViewController cannot be cast to HandlerMethod

Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello am using spring 3.1.2

i got this error
java.lang.ClassCastException: org.springframework.web.servlet.mvc.ParameterizableViewController cannot be cast to org.springframework.web.method.HandlerMethod


public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
HttpSession currentSession = request.getSession();
HandlerMethod handlerMethod = (HandlerMethod) handler;
Class<? extends Object> entryClass = handlerMethod.getBean().getClass();

if (entryClass.isAnnotationPresent(Navigation.class)) {
List<NavigationEntry> prevPath = (List<NavigationEntry>) currentSession.getAttribute(NAVIGATION_PATH);
if (prevPath == null) {
prevPath = new ArrayList<NavigationEntry>();

List<NavigationEntry> basePath = buildBasePath(prevPath, entryClass);
NavigationEntry entry = generateNavigationEntry(entryClass, currentSession);
currentSession.setAttribute(NAVIGATION_PATH, basePath);
} else {


i got this error in underlined line.

Please help me to sort out of this issue
Posts: 9708
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From what I can see from the documentation you get the controller instance in the handler object not an instance of HandlerMethod class. So instead of

You can directly do
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic