Question

I have a spring servlet-context.xml file with the following definition in it:

...
xmlns:mongo="http://www.springframework.org/schema/data/mongo"
http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
....
<mongo:repositories base-package="com.example.repositories.mongodb"/>

This causes a compilation error in STS:

Description Resource Path Location Type Error occured processing XML 'tried to access method org.springframework.context.annotation.AnnotationConfigUtils.processCommonDefinitionAnnotations(Lorg/springframework/beans/factory/annotation/AnnotatedBeanDefinition;)V from class org.springframework.data.repository.config.RepositoryComponentProvider'. See Error Log for more details servlet-context.xml /example/src/main/webapp/WEB-INF line 97 Spring Beans Problem

When I remove the content of base-package the error goes away. I thought that maybe some of the repositories I defined are wrong, but they seem to be working fine. The application starts fine and works well. I am using spring-data-mongodb 1.4.0

Any ideas?

Was it helpful?

Solution

solved with STS 3.5.0. STS 3.5.0 comes with Spring 4.0.2.

OTHER TIPS

Make sure you use a recent Spring version. Spring Data Mongo 1.4.0 requires Spring 3.2.8:

$ git checkout 1.4.0.RELEASE
$ mvn dependency:list -Dsort
…
[INFO]    org.springframework.data:spring-data-commons:jar:1.7.0.RELEASE:compile
[INFO]    org.springframework.data:spring-data-mongodb:jar:1.4.0.RELEASE:compile
[INFO]    org.springframework:spring-aop:jar:3.2.8.RELEASE:compile
[INFO]    org.springframework:spring-aspects:jar:3.2.8.RELEASE:compile
[INFO]    org.springframework:spring-beans:jar:3.2.8.RELEASE:compile
[INFO]    org.springframework:spring-context:jar:3.2.8.RELEASE:compile
[INFO]    org.springframework:spring-core:jar:3.2.8.RELEASE:compile
[INFO]    org.springframework:spring-expression:jar:3.2.8.RELEASE:compile
[INFO]    org.springframework:spring-jdbc:jar:3.2.8.RELEASE:compile
[INFO]    org.springframework:spring-orm:jar:3.2.8.RELEASE:compile
[INFO]    org.springframework:spring-test:jar:3.2.8.RELEASE:test
[INFO]    org.springframework:spring-tx:jar:3.2.8.RELEASE:compile

In particular we depend on the method the exception shows being made public as of Spring 3.2.5 IIRC.

I was facing the similar and I have the post also for it(Setting up spring app with spring data repositories and mongo db). I am using spring 4.0.1 jars and Spring Data Mongo 1.4.0 jar and still I see this problem. Error is shown where you mention the mongo:repository tag. You wont get any clue why its happening. Finally I changed the spring jar version to 4.0.0 and then removed all spring jars from the maven repository and tried to (updated maven first)build again..It worked. I am pretty sure that it will work with 4.0.1 spring jars also.( I was having another project with the same configuration and it was working fine with 4.0.1 jars:)) I contribute this issue to maven and eclipse. Some issue that I don't have any clue at all.

If you are using right set of jars as Oliver suggested then you need to do some trial and error:)

I was using spring 4.0.2 and all is working fine till yesterday. Today when I updated spring-data-mongodb from 1.3.4 to 1.4.0, I start getting this error. Is 1.4.0 not compatible with spring 4.0.2? I have checked my maven dependency graph all the spring jars point to 4.0.2

[UPDATE] These errors gone after I upgraded to STS 3.5.1

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top