0

I have a problem with spring config which is as follows.

 <?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    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">

    <!-- DispatcherServlet Context: defines this servlet's request-processing 
        infrastructure -->

    <!-- Enables the Spring MVC @Controller programming model -->
    <annotation-driven />

    <!-- Handles HTTP GET requests for /resources/** by efficiently serving 
        up static resources in the ${webappRoot}/resources directory -->
    <resources mapping="/resources/**" location="/resources/" />

    <!-- Resolves views selected for rendering by @Controllers to .jsp resources 
        in the /WEB-INF/views directory -->
    <beans:bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <beans:property name="prefix" value="/WEB-INF/views/" />
        <beans:property name="suffix" value=".jsp" />
    </beans:bean>

    <context:component-scan base-package="com.novcode.date" />

    <beans:bean name="employee" class="com.novcode.date.Employee"
        scope="request"></beans:bean>
    <beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName" value="org.sql.Driver" />
        <property name="url" value="jdbc:mysql://localhost:3306/securepassspring" />
        <property name="username" value="root" />
        <property name="password" value="spuser" />
    </beans:bean>

    <beans:bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="packagesToScan">
            <value>com.novcode.date</value>
        </property>
        <property name="configurationClass">
            <value>org.hibernate.cfg.AnnotationConfiguration</value>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.MYSQL5Dialect</prop>
                <prop key="hibernate.show_sql">true</prop>
            </props>
        </property>
    </beans:bean>
</beans:beans>

The main problem i am facing is that I am getting Cross marks in red saying Error Image

I am sure that I have cross checked many times on this error, i am also sure that I have to do something with the xsd thing but I am not sure abuot the same as i am a beginner in spring.

my Maven is as follows.This is spring version. Please do not worry about the data in the properties in can edit the same.

Please help, thanks.

Abhijeet
  • 689
  • 2
  • 10
  • 19
  • [this may be help full to you](http://stackoverflow.com/a/12226551/2749470) and [this too](http://stackoverflow.com/a/10523227/2749470) – Bhargav Modi Feb 09 '15 at 08:46
  • use all <=2.5 like given in this [answer](http://stackoverflow.com/a/6059986/2749470) – Bhargav Modi Feb 09 '15 at 08:50
  • I request xml file with changes since I tried the suggested changes but did not work. what can i do if the Sts does not give a right xml file..? Or might be that I do not exactly know what to change.. – Abhijeet Feb 09 '15 at 09:28

1 Answers1

0

Since you have your namespace with prefix beans xmlns:beans="http://www.springframework.org/schema/beans", you need to use to resolve the error. if you declare your namespace to be like this, xmlns="http://www.springframework.org/schema/beans", then you don't need to define beans everywhere. Hope this helps.

minion
  • 4,313
  • 2
  • 20
  • 35