Announcement Announcement Module
Collapse
No announcement yet.
Spring MVC 3.1.0.RELEASE and mvc:resources lookup not working after migration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring MVC 3.1.0.RELEASE and mvc:resources lookup not working after migration

    Hi All,
    I've just tried migrating my web-app which is working fine from spring-mvc 3.0.6.RELEASE to spring-mvc 3.1.0.RELEASE.

    I've found that my css , javascript and other image resources are now not being retrieved at all .

    I use the following configurations in my servlet to configure where my resources are located but it simply doesnt work with 3.1.0 whilst 3.0.6 works:

    Code:
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:jee="http://www.springframework.org/schema/jee" xmlns:mvc="http://www.springframework.org/schema/mvc"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd 
    http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd 
     http://www.springframework.org/schema/mvc
     http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
    
    	<bean
    		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    		<property name="locations">
    			<list>
    				<value>classpath:my-domain.properties</value>
    				<value>classpath:my-web.properties</value>
    			</list>
    		</property>
    		<property name="ignoreUnresolvablePlaceholders" value="true" />
    		<property name="order" value="0" />
    	</bean>
    	
    	<context:component-scan base-package="com.mandary" />
    
    	<mvc:resources mapping="/resources/**" location="/resources/" />
    
    	<mvc:annotation-driven />
    
    	<bean
    		class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
    	<bean
    		class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
    
    	<bean
    		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    		<property name="prefix" value="/WEB-INF/jsp/" />
    		<property name="suffix" value=".jsp" />
    	</bean>
    Any idea what could be the problem or anything that may need to be changed ?

    kind regards,
    Javed

  • #2
    Any output from the logs after setting 'org.springframework.web' to DEBUG? For what it's worth it works in the spring-mvc-showcase.

    Comment


    • #3
      spring-js-resources reference

      I had the same issue... taking a 3.0.5 Spring WebMVC project and upgrading to 3.1.0 it wouldn't find the Spring javascript files at runtime from the resources folder, giving 404 errors.

      After I added the following to the pom.xml for my project it was able to find the Spring.js and related javascript files again.

      <dependency>
      <groupId>org.springframework.webflow</groupId>
      <artifactId>spring-js-resources</artifactId>
      <version>2.3.0.RELEASE</version>
      </dependency>

      Comment

      Working...
      X