java.lang.ClassCastException: org.springframework.web.servlet.ModelAndView cannot be cast to java.lang.String

Spring JIRA | Stan Rosenberg | 4 years ago
  1. 0

    In debug mode (log4j.category.org.springframework = DEBUG), spring is throwing an exception inside the generated toString method. The culprit may be the line: logger.debug("Mapping [" + lookupPath + "] to " + handler), in AbstractUrlHandlerMapping. Here is the full stack trace, java.lang.ClassCastException: org.springframework.web.servlet.ModelAndView cannot be cast to java.lang.String at com.appnexus.dmf.api.controllers.JobController$$EnhancerByCGLIB$$50e3af05.toString(<generated>) at java.lang.String.valueOf(String.java:2826) at java.lang.StringBuilder.append(StringBuilder.java:115) at org.springframework.web.servlet.HandlerExecutionChain.toString(HandlerExecutionChain.java:204) at java.lang.String.valueOf(String.java:2826) at java.lang.StringBuilder.append(StringBuilder.java:115) at org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.getHandlerInternal(AbstractUrlHandlerMapping.java:124) at org.springframework.web.servlet.handler.AbstractHandlerMapping.getHandler(AbstractHandlerMapping.java:297) at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1091) at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1076) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:896) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:816) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:534) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:476) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:934) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:404) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:869) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:151) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:346) at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:581) at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1040) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:592) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:214) at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:526) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:41) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:680)

    Spring JIRA | 4 years ago | Stan Rosenberg
    java.lang.ClassCastException: org.springframework.web.servlet.ModelAndView cannot be cast to java.lang.String
  2. 0

    In debug mode (log4j.category.org.springframework = DEBUG), spring is throwing an exception inside the generated toString method. The culprit may be the line: logger.debug("Mapping [" + lookupPath + "] to " + handler), in AbstractUrlHandlerMapping. Here is the full stack trace, java.lang.ClassCastException: org.springframework.web.servlet.ModelAndView cannot be cast to java.lang.String at com.appnexus.dmf.api.controllers.JobController$$EnhancerByCGLIB$$50e3af05.toString(<generated>) at java.lang.String.valueOf(String.java:2826) at java.lang.StringBuilder.append(StringBuilder.java:115) at org.springframework.web.servlet.HandlerExecutionChain.toString(HandlerExecutionChain.java:204) at java.lang.String.valueOf(String.java:2826) at java.lang.StringBuilder.append(StringBuilder.java:115) at org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.getHandlerInternal(AbstractUrlHandlerMapping.java:124) at org.springframework.web.servlet.handler.AbstractHandlerMapping.getHandler(AbstractHandlerMapping.java:297) at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1091) at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1076) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:896) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:816) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:534) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:476) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:934) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:404) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:869) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:151) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:346) at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:581) at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1040) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:592) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:214) at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:526) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:41) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:680)

    Spring JIRA | 4 years ago | Stan Rosenberg
    java.lang.ClassCastException: org.springframework.web.servlet.ModelAndView cannot be cast to java.lang.String
  3. 0

    Around advice behaving strange

    Stack Overflow | 3 weeks ago | HyperZ
    java.lang.ClassCastException: org.springframework.web.servlet.ModelAndView cannot be cast to java.lang.Boolean
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Bug ID: JDK-6499662 "java.lang.ClassCastException: cannot be cast to java.lang.String" happens from time to time

    sun.com | 4 months ago
    java.lang.ClassCastException: cannot be cast to java.lang.String
  6. 0

    Bug ID: JDK-6499662 "java.lang.ClassCastException: cannot be cast to java.lang.String" happens from time to time

    sun.com | 4 months ago
    java.lang.ClassCastException: cannot be cast to java.lang.String

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      org.springframework.web.servlet.ModelAndView cannot be cast to java.lang.String

      at com.appnexus.dmf.api.controllers.JobController$$EnhancerByCGLIB$$50e3af05.toString()
    2. com.appnexus.dmf
      JobController$$EnhancerByCGLIB$$50e3af05.toString
      1. com.appnexus.dmf.api.controllers.JobController$$EnhancerByCGLIB$$50e3af05.toString(<generated>)
      1 frame
    3. Java RT
      StringBuilder.append
      1. java.lang.String.valueOf(String.java:2826)
      2. java.lang.StringBuilder.append(StringBuilder.java:115)
      2 frames
    4. Spring MVC
      HandlerExecutionChain.toString
      1. org.springframework.web.servlet.HandlerExecutionChain.toString(HandlerExecutionChain.java:204)
      1 frame
    5. Java RT
      StringBuilder.append
      1. java.lang.String.valueOf(String.java:2826)
      2. java.lang.StringBuilder.append(StringBuilder.java:115)
      2 frames
    6. Spring MVC
      FrameworkServlet.doGet
      1. org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.getHandlerInternal(AbstractUrlHandlerMapping.java:124)
      2. org.springframework.web.servlet.handler.AbstractHandlerMapping.getHandler(AbstractHandlerMapping.java:297)
      3. org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1091)
      4. org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1076)
      5. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:896)
      6. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
      7. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920)
      8. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:816)
      8 frames
    7. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
      1 frame
    8. Spring MVC
      FrameworkServlet.service
      1. org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801)
      1 frame
    9. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      1 frame
    10. Jetty
      HttpConnection.handle
      1. org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:534)
      2. org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:476)
      3. org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:934)
      4. org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:404)
      5. org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:869)
      6. org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
      7. org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:151)
      8. org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
      9. org.eclipse.jetty.server.Server.handle(Server.java:346)
      10. org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:581)
      11. org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1040)
      12. org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:592)
      13. org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:214)
      14. org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)
      14 frames
    11. GWT dev
      SelectChannelEndPoint$1.run
      1. org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:526)
      2. org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:41)
      2 frames
    12. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      3. java.lang.Thread.run(Thread.java:680)
      3 frames