Cannot resolve the name 'repository:auditing-attributes' when running a Test with Spring Data

Hi all,

I have an Maven project that uses Spring Data 1.3. On the command line I can run a mvn test and everything runs fine. The problem is when I want to execute my test inside Intellij Idea (13.1.2). I get the exception below. There are a few references of a similar bugs in StackOverflow but it looks like it's not the same (because the XSD is ok). What puzzles me is that on the command line, with Maven, it works, but not within Intellij Idea.

Basically, if you look at the spring-jpa-1.3.xsd descriptor you will find a ref="repository:auditing-attributes" which is defined in spring-repository.xsd. And Intellij Idea is not happy. I have to say that the project is quite big and uses tones of Spring XML configuration files. But all use spring-jpa-1.3.xsd, so there is no version problem I would say.

Any idea ?
Thanks


[1;31m17:00:25.007 [main] ERROR o.s.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@1bf7b23] to prepare test instance [fr.dsirc.dsn.core.decl.service.DeclarationDsnServiceTest@13a34af]
[0;39mjava.lang.IllegalStateException: Failed to load ApplicationContext
     at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157) ~[spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:103) ~[spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:73) ~[spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:313) ~[spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211) [spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288) [spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.11.jar:na]
     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:284) [spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) [spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88) [spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) [junit-4.11.jar:na]
     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) [junit-4.11.jar:na]
     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) [junit-4.11.jar:na]
     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) [junit-4.11.jar:na]
     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) [junit-4.11.jar:na]
     at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) [spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [junit-4.11.jar:na]
     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) [spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.junit.runner.JUnitCore.run(JUnitCore.java:160) [junit-4.11.jar:na]
     at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) [junit-rt.jar:na]
     at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) [junit-rt.jar:na]
     at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) [junit-rt.jar:na]
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_10]
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_10]
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_10]
     at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_10]
     at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) [idea_rt.jar:na]
Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:commonTUSpringContext.xml]
Offending resource: class path resource [springContext-test.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [notificationIntraSpringContext.xml]
Offending resource: class path resource [commonTUSpringContext.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 36 in XML document from class path resource [notificationIntraSpringContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'repository:auditing-attributes' to a(n) 'attribute group' component.
     at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:245) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:196) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:181) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:243) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.test.context.support.AbstractGenericContextLoader.loadBeanDefinitions(AbstractGenericContextLoader.java:219) ~[spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:103) ~[spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:57) ~[spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:100) ~[spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:248) ~[spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124) ~[spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148) ~[spring-test-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     ... 27 common frames omitted
Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [notificationIntraSpringContext.xml]
Offending resource: class path resource [commonTUSpringContext.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 36 in XML document from class path resource [notificationIntraSpringContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'repository:auditing-attributes' to a(n) 'attribute group' component.
     at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:271) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:196) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:181) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:239) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     ... 46 common frames omitted
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 36 in XML document from class path resource [notificationIntraSpringContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'repository:auditing-attributes' to a(n) 'attribute group' component.
     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:255) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     ... 57 common frames omitted
Caused by: org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'repository:auditing-attributes' to a(n) 'attribute group' component.
     at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.xs.traversers.XSDAttributeGroupTraverser.traverseLocal(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.xs.traversers.XSDAbstractTraverser.traverseAttrsAndAttrGrps(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.processComplexContent(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexTypeDecl(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseLocal(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseGlobal(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.xs.traversers.XSDHandler.traverseSchemas(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.xs.XMLSchemaValidator.findSchemaGrammar(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.xs.XMLSchemaValidator.emptyElement(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) ~[xercesImpl-2.6.2.jar:na]
     at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
     ... 60 common frames omitted

Please sign in to leave a comment.