i'm starting with Spring 3 (3.1.2) and Google App Engine.
I've followed a tutoria online, now, i've my bean-realted xml which has a problem while starting.
this is the code
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="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">
<context:component-scan base-package="my.example">
where the root package of all the java file is "my.example". The subpackage are "model" and "controller" with subpackages as well. now.
when i start the app i receive back this error:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 10 in XML document from ServletContext resource [/WEB-INF/spring-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'.
with a lot of more stacktrace.
does anyone know how i can solve this? i checked the XSD and they seems to be correct.
You are probably missing spring-context.jar, that is the one which contains the definition for context schema.
Problem is incompatible schema locations with your spring-context dependencies.
Replace
by
That should do the trick! I was using spring-context 3.1.1 and I was getting the same error referring to http://www.springframework.org/schema/context/spring-context-2.1.xsd
However, you should also do a maven tree dependendency and check if you've got different spring versions. This error could be due to this fact also...
I don't know if this helps any, but I had an error very similar to yours while using the maven shade plugin to make a single .jar, and the shade plugin wiped out the
spring.handlers
andspring.schemas
fromMETA-INF/
.This SO answer pointed me in the right direction: https://stackoverflow.com/a/3650844/7008
And the document on using an AppendingTransformer to add those spring bits back in to your
META-INF/
folder did the trick for me: http://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html#AppendingTransformer