Error: "schemaLocation value *** must have even number of URI's." on namespaces in spring dispatcher Error: "schemaLocation value *** must have even number of URI's." on namespaces in spring dispatcher xml xml

Error: "schemaLocation value *** must have even number of URI's." on namespaces in spring dispatcher


The schemaLocation attribute references an XML Schema document for a namespace.

Basically when you type:

xmlns:expns="http://www.example.com"xsi:schemaLocation="http://www.example.com                    http://www.example.com/schema/example.xsd"

You are saying: "I'm going to use the prefix expns for the elements of the namespace http://www.example.com. Also, so you can validate those elements, get the XSD Schema file for http://www.example.com in http://www.example.com/schema/example.xsd"

So, in other words, the format is:

xsi:schemaLocation="namespace-a   where_to_get_the_xsd_for_namespace-a                    namespace-b   where_to_get_the_xsd_for_namespace-b                    namespace-c   where_to_get_the_xsd_for_namespace-c"

And so on.

That's why it must me an even number.


More info and examples can be found here.


@acdcjunior explanation is correct and to resolve the OP's issue, the schemaLocation for the namespace p which is missing needs to be added

<beans xmlns="http://www.springframework.org/schema/beans"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xmlns:p="http://www.springframework.org/schema/p"   xmlns:aop="http://www.springframework.org/schema/aop"   xmlns:tx="http://www.springframework.org/schema/tx"   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsdhttp://www.springframework.org/schema/p http://www.springframework.org/schema/xx-xx.xsd   http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

On a further note this warning also occurs if the order of namespace definitions and schemaLocation definitions are different