spring data - jpa application-context schema error -
i having issue xml schema spring jpa repository.
i have tried suggestions available online not seem resolve it.
please help.
getting error in application-context.xml repository.
multiple annotations found @ line: - cvc-complex-type.2.4.c: matching wildcard strict, no declaration can found element 'repository:repositories'. - cvc-complex-type.2.4.a: invalid content found starting element 'repositories'. 1 of '{"http://www.springframework.org/schema/ beans":import, "http://www.springframework.org/schema/beans":alias, "http://www.springframework.org/schema/beans":bean, wc[##other:"http:// www.springframework.org/schema/beans"]}' expected.
my application context looks this
<?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" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:repository="http://www.springframework.org/schema/data/repository" xsi:schemalocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd http://www.springframework.org/schema/data/repository http://www.springframework.org/schema/data/repository/spring-repository-1.7.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <jdbc:embedded-database id="datasource" type="h2" /> <tx:annotation-driven transaction-manager="transactionmanager" /> <repositories base-package="com.company.repositories" /> <context:component-scan base-package="com.company.*" /> </beans>
we recommend refer schema files don't have version numbers in them make sure pick version form dependency in classpath.
the reason xsd doesn't know kind of version concept. means spring-beans.xsd
, spring-beans-3.0.xsd
unrelated xsd in turn means if happen import both of them (i'll in second), create errors xsd considers types declared in them declared twice.
the reason might accidentally import non-versioned xsd spring data xsds refer them make sure pick latest version (to forward compatible).
long story short: remove explicit versions names , should good.
Comments
Post a Comment