Reputation: 67
i know this has been asked in so many queries. I am posting as I tried all options and still getting the error.
<?xml version="1.0" encoding="UTF-8"?>
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<mvc:annotation-driven></mvc:annotation-driven>
<context:component-scan base-package="com.cts"></context:component-scan>
<mvc:bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp" />
<property name="suffix" value=".jsp" />
</mvc:bean>
<mvc:bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
</mvc:bean>
<bean id="validator"
class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"></bean>
<mvc:interceptors>
<bean class="org.springframework.web.,servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="locale"></property>
</bean>
</mvc:interceptors>
I am getting that
Description Resource Path Location Type cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:bean'. spring-servlet.xml /CATestSlotBooking_Skeleton/WebContent/WEB-INF line 17 XML Problem
i am using Spring 4.01 release jars
Upvotes: 0
Views: 344
Reputation: 1737
You can use this spring-servlet.xml file
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:component-scan base-package="com.cts"></context:component-scan>
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
</bean>
<bean id="validator"
class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"></bean>
<mvc:interceptors>
<bean class="org.springframework.web.,servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="locale"></property>
</bean>
</mvc:interceptors>
<mvc:annotation-driven />
</beans>
Upvotes: 1
Reputation: 1528
Looks like schema is missing.
Update XML header like below.
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
Upvotes: 2
Reputation: 2239
InternalResourceViewResolver
& messageSource
are wrongly defined in your xml. There is no such tag as mvc:bean
. That's why a problem. Should be as follows.
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
</bean>
Upvotes: 0