Setting up spring app with spring data repositories and mongo db Setting up spring app with spring data repositories and mongo db mongodb mongodb

Setting up spring app with spring data repositories and mongo db


In my case it was spring data jpa version which was causing problem. I am not using spring data mongodb but spring data jpa instead. I started this projected today with latest versions (spring-framework 4.0.2.RELEASE, spring-data-jpa 1.5.0.RELEASE). I ensured that all transitive dependencies from maven (from spring side as well as from spring data side) are that of latest version but no lock.

Following this thread, tried to downgrade spring version to 4.0.0.RELEASE but no luck. I even explored the org.springframework.context.annotation.AnnotationConfigUtils class from spring-context-4.0.2.RELEASE.jar (and also in spring-context-4.0.0.RELEASE.jar) from within my workspace and confirmed that indeed processCommonDefinitionAnnotations is a public method thus IllegalAccessError can not be an issue resulting from these jars.

Finally I downgraded my spring-data-jpa from 1.5.0.RELEASE to 1.4.4.RELEASE and voila all problems are solved on maven update. I am using STS 3.4 if it helps anyone.

Since this was the first post I found on googling this error, thought of posting it here so that others who are facing same problems can potentially solve it with this tip. I have opened bug report at https://jira.springsource.org/browse/DATAJPA-490

@Oliver, tried the dependency management suggested but no luck. I have also added dependency:list output to the bug report as requested.


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.


Make sure you don't accidentally pull in an older Spring version (something before 3.2.5) into the classpath. The older methods don't have the method listed in the exception public. This is then causing the exception. I recommend to use the following Maven config snippet to enforce all Spring libraries to be in 4.0.2:

<dependencyManagement>  <dependencies>    <dependency>      <groupId>org.springframework</groupId>      <artifactId>spring-framework-bom</artifactId>      <version>4.0.2.RELEASE</version>      <type>pom</type>      <scope>import</scope>    </dependency>  </dependencies></dependencyManagement>