0

I have followed the following Spring MVC tutorial which works fine until I deploy step 4.6: Spring MVC step by step tutorial

The Errors I get are:

SEVERE: Context initialization failed
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 10 i
n XML document from ServletContext resource [/WEB-INF/springapp-servlet.xml] is
invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4
.a: Invalid content was found starting with element 'beans'. One of '{"http://ww
w.springframework.org/schema/beans":description, "http://www.springframework.org
/schema/beans":import, "http://www.springframework.org/schema/beans":alias, "htt
p://www.springframework.org/schema/beans":bean, WC[##other:"http://www.springfra
mework.org/schema/beans"]}' is expected.
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadB
eanDefinitions(XmlBeanDefinitionReader.java:369)
Alastair
  • 55
  • 1
  • 7

1 Answers1

1

I don't know why they are showing it like that and honestly you shouldn't be looking at a super old tutorial like that, but the solution is to simply remove the <beans> in

<beans xmlns="http://www.springframework.org/schema/beans"
       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-2.5.xsd">

<!-- the application context definition for the springapp DispatcherServlet -->

<beans> <---remove this guy
Sotirios Delimanolis
  • 274,122
  • 60
  • 696
  • 724