• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
monicka rk akilan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • 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

===========================================================================================================================

@Override
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)) {
@SuppressWarnings("unchecked")
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);
basePath.add(entry);
currentSession.setAttribute(NAVIGATION_PATH, basePath);
} else {
clearNavigationPath(currentSession);
}
}

====================================================================================================

i got this error in underlined line.

Please help me to sort out of this issue
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic