user3460409
user3460409

Reputation:

error message with spring “Cannot find the declaration of element 'beans'.”

I'm trying to set up a simple spring application and I'm getting the below exception.

Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 8 in XML document from class path resource [NewFile.xml] is invalid; nested e
xception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.

I don't find my problem. this is my NewFile.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mail="http://www.springframework.org/schema/integration/mail"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration/mail
http://www.springframework.org/schema/integration/mail/spring-integration-mail-1.0.xsd" >

I use Spring Integration 1.0.4, Spring core 2.5.6, and javamail 1.4

Best Regards

Upvotes: 4

Views: 2108

Answers (1)

Dave Newton
Dave Newton

Reputation: 160170

There are two "schema" in the path:

<beans xmlns="http://www.springframework.org/schema/schema/beans"

IIRC only one is required:

<beans xmlns="http://www.springframework.org/schema/beans"

Upvotes: 2

Related Questions