0

I've googled around for this but I couldn't find a clear answer, and i think there is something basic i am just plainly missing here.

I have set up a spring app, fairly straight forward up until this point, having the dispatcher recieve the .htm request and the view resolver has been working correctly mapping it to the correct internal .jsp file within the WEB-INF/jsp/ folder. All is working well with ModelAndView objects also.

However, when I rename the controller's physical file name (and its internal classname to match), + rename the bean's 'class' value my springtest-servlet.xml, I get a:

'WARNING: No mapping found for HTTP request with URI [/springtest/hello.htm] in DispatcherServlet with name 'springtest' during run-time when the mapping is resolved.'

I understand that this is a noob question for spring devs, but what is the way around this without recreating the controller from scratch?

Below are the relevant configuration files if it helps: (server is glassfish)

springtest-servlet.xml

<bean id="viewResolver"
      class="org.springframework.web.servlet.view.InternalResourceViewResolver"
      p:prefix="/WEB-INF/jsp/"
      p:suffix=".jsp" />

    <bean name="indexController"
      class="org.springframework.web.servlet.mvc.ParameterizableViewController"
      p:viewName="index" />
<bean name="/hello.htm" class="springtest.web.InventoryController"/>

web.xml

    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
    <servlet-name>springtest</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>springtest</servlet-name>
    <url-pattern>*.htm</url-pattern></servlet-mapping>

springtest.web.InventoryController.java

public class InventoryController implements Controller
{
    protected final Log logger = LogFactory.getLog(getClass());
    @Override
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String now = (new Date()).toString();
        return new ModelAndView("hello", "now", now);
     }

}

Any advice would be greatly appreciated,

Thanks

Steve Rathbone
  • 468
  • 1
  • 5
  • 14
  • Did you try complete reloading app? It seems like one of two files - springtest-servlet.xml or InventoryController didn't go to the server, so you have files from different versions there. Try deleting contents on server and deploying again. Also, if you a new to Spring, why not using Spring 3 instead of 2? – ffriend Dec 09 '10 at 01:25
  • yep, after a lot of reading, I'm thinking its a build/deploy problem too. I've tried to use the 'clean and build' from netbeans, but no dice. i'll try deleting and redeploying myself manually.. – Steve Rathbone Dec 10 '10 at 01:17
  • Ok, I think there's something wrong with my project file and the build/deploy process in general with netbeans' automatic build and deploy functionality - i'm going to go dig around on what I've done to break it, and get a better understanding of what's happening underneath the covers. – Steve Rathbone Dec 10 '10 at 01:41
  • Official documentation for Glassfish 3 (http://docs.sun.com/app/docs/coll/1343.13) for background reading is quite concise and easy to read. it also appears to the best also. – Steve Rathbone Dec 14 '10 at 01:00
  • http://static.springsource.org/spring/docs/3.0.0.M3/spring-framework-reference/html/ch16s02.html - and its associated pages were also quite useful. – Steve Rathbone Dec 16 '10 at 02:49

0 Answers0