views:

684

answers:

4

This is a long shot but hopefully someone can help.

My application is using spring framework mvc. 99% of if works properly. However when I attempt to go to one link lets call it [path]/link.html. I get a 404 error. If however, I go to this link within my development environment (tomcat,windows,IE and eclipse) I get no such 404 error (everything works as expected). Its only happening in my production site (web logic).

I've looked at log files and nothing is showing up as a problem.

<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <props> 
<prop key="/link.html">linkController</prop>
...
</props>
</property>
</bean>
+1  A: 

You probably need to map requests for HTML files to the Controller servlet in your web.xml file using the <servlet-mapping> element. You might want to consider using link.do instead of link.html, because mapping requests for HTML files to your controller servlet could make serving static content in your application a little tricky.

On another note, in general, you want your development stack to match your production stack as closely as possible. It seems likely that you would have at least found out about this issue sooner if you were developing using WebLogic instead of Tomcat, since you're using WebLogic in production.

Paul Morie
The mapping is consistent with all other mappings which work properly. In other words .html is mapped to the servlet.
oneBelizean
+1  A: 

Without seeing the offending URL I'd guess you've got a problem with your URL construction and that it simply doesn't correspond to a resource on the production server, rather than it being a problem with your config, given that other HTML resources are accessible.

I always use the JSTL URL tag to construct URLs, which covers off everything described here (http://www.ibm.com/developerworks/java/library/j-jstl0318/#N10532)

If using JSTL isn't an option, then the link should give you some pointers as to what you need to consider when constructing a URL.

Nick Holt
I altered the link to use JSTL with no luck.
oneBelizean
Please can you post the URL that works locally and the one that's broken in production?
Nick Holt
+1  A: 

Turn up logging from the org.springframework loggers and see what happens within Spring (or if your web request is even making it to DispatcherServlet) when you request /link.html.

matt b
A: 

The problem was in fact not with spring/jsp/etc... The problem was with how the location directives in apache were configured. A trailing slash was needed for the path within the directive.

oneBelizean