Announcement Announcement Module
No announcement yet.
Could not resolve view with name... Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Could not resolve view with name...

    I'm new to Spring and am trying to get a prototype application up and running with Spring MVC. I got the first controller up fine, but when I added a second controller and view, I started getting an error that I can't resolve. It seems straightforward but I can't figure it out. I've Google'd and looked through the forums but can't find anything helpful. Here is the exception I'm getting...

    javax.servlet.ServletException: Could not resolve view with name 'request-requestForm' in servlet with name 'cms'
    at org.springframework.web.servlet.DispatcherServlet. render(
    at org.springframework.web.servlet.DispatcherServlet. doDispatch(
    at org.springframework.web.servlet.DispatcherServlet. doService(
    at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(
    at org.springframework.web.servlet.FrameworkServlet.d oGet(
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:697)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
    at ternalDoFilter(
    at Filter(
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(
    at ternalDoFilter(
    at Filter(
    at org.apache.catalina.core.StandardWrapperValve.invo ke(
    at org.apache.catalina.core.StandardContextValve.invo ke(
    at alve.invoke(
    at oke(
    at org.apache.catalina.core.StandardHostValve.invoke(
    at org.apache.catalina.valves.ErrorReportValve.invoke (
    at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve .invoke(
    at org.apache.catalina.core.StandardEngineValve.invok e(
    at org.apache.catalina.connector.CoyoteAdapter.servic e(
    at org.apache.coyote.http11.Http11Processor.process(H
    at org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt
    at Socket(
    at .run(

    The app is very simple at this point. Here are the contents of my file....

    request-index.class=org.springframework.web.servlet.view.J stlView
    request-requestForm.class=org.springframework.web.servlet. view.JstlView

    Here is the code in the controller that I know is being called because I print out a debug statement....

    public ModelAndView createRequest(HttpServletRequest request, HttpServletResponse response)throws Exception{
    return new ModelAndView("request-requestForm",new java.util.HashMap());

    Any pointers to some documentation would be greatly appreciated..

  • #2
    It seems that you have defined a ResourceBundleViewResolver configuration. Can you post that? And if possible your controller definitions from the applicationContext xml as well.


    • #3
      Here is my spring configuration and web.xml...

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "">
      <!-- - Application context definition for "springapp" DispatcherServlet. -->

      <bean id="publicUrlMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
      <property name="mappings">
      <prop key="/request.htm">requestController</prop>
      <prop key="/menu.htm">menuController</prop>


      <!-- Controller Definitions -->
      <bean id="requestController" class="" >
      <property name="methodNameResolver">
      <ref local="requestMethodNameResolver"/>
      <bean id="menuController" class="">
      <property name="methodNameResolver">
      <ref local="requestMethodNameResolver"/>

      <!-- Control resolvers -->
      <bean id="requestMethodNameResolver" class="org.springframework.web.servlet.mvc.multiac tion.ParameterMethodNameResolver">
      <property name="paramName">

      <!-- View resolvers -->
      <bean id="viewResolver" class="org.springframework.web.servlet.view.Resour ceBundleViewResolver">
      <property name="basename">

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app id="WebApp_ID" version="2.4" xmlns="" xmlns:xsi="" xsi:schemaLocation="">

      <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>




      • #4
        You may have the following issues

        a) views may not exist in your classes path (WEB-INF/classes)
        b) The definition of the request-requestForm may not exist there or not be configured properly Look up this. (Section 14.2.1).
        If possible display the property file details as well.


        • #5
          Property values are in the original post.


          • #6
            possible solution

            We had a similar problem -
            this was trying to access a URL for a REST service.
            It worked fine through the browser, but would bomb with commons HTTPClient

            was the fix.

            not too sure where the problem ultimately lies. But, according to the spec (
            "If no Accept header field is present, then it is assumed that the client accepts all media types"