title: STS + Spring Data JPA + Hibernate repositories XML config issue
body: <p>I have an issue in STS, where it is displaying an error in my context.xml file when referencing the jpa:repositories node. It does not prevent the app from running (actually seems to be working well), but I cannot get the error to go away.</p>
  
  <p>Error:</p>
  
  <pre><code>Error occured processing XML 'Class
  org/springframework/data/repository/config/RepositoryComponentProvider illegally 
  accessing "package private" member of class org/springframework/context/
  annotation/AnnotationConfigUtils'. See Error Log for more details
  </code></pre>
  
  <p>Segment of XML with problem:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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:tx="http://www.springframework.org/schema/tx"
      xmlns:jdbc="http://www.springframework.org/schema/jdbc"
      xmlns:jpa="http://www.springframework.org/schema/data/jpa"
      xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt;
  
      &lt;tx:annotation-driven transaction-manager="transactionManagerSpecial" /&gt;
      &lt;jpa:repositories base-package="com.testcompany.**.repository" transaction-manager-ref="transactionManagerSpecial"&gt;&lt;/jpa:repositories&gt;
  </code></pre>
  
  <p>Spring version (core/tx/beans/test/aop/context/expression): 4.0.2.RELEASE</p>
  
  <p>Spring Data JPA version: 1.5.0.RELEASE</p>
  
  <p>Hibernate version (not sure why this would matter): 4.2.1.Final</p>
  
  <p>POM:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.test.spring&lt;/groupId&gt;
  &lt;artifactId&gt;test-spring-transactional&lt;/artifactId&gt;
  &lt;version&gt;1.0.1&lt;/version&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  &lt;name&gt;Spring Transactional Test Project&lt;/name&gt;
  &lt;url&gt;http://www.imatestapp.com&lt;/url&gt;
  &lt;description&gt;This project is a minimal jar utility with Spring configuration for Hibernate set up.&lt;/description&gt;
  &lt;properties&gt;
      &lt;maven.test.failure.ignore&gt;true&lt;/maven.test.failure.ignore&gt;
      &lt;spring.framework.version&gt;4.0.2.RELEASE&lt;/spring.framework.version&gt;
      &lt;hibernate.version&gt;4.2.1.Final&lt;/hibernate.version&gt;
      &lt;spring.framework.data.version&gt;1.5.0.RELEASE&lt;/spring.framework.data.version&gt;
  &lt;/properties&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
          &lt;version&gt;${hibernate.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.validation&lt;/groupId&gt;
          &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
          &lt;version&gt;1.0.0.GA&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
          &lt;version&gt;${spring.framework.version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-context-support&lt;/artifactId&gt;
          &lt;version&gt;${spring.framework.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-aop&lt;/artifactId&gt;
          &lt;version&gt;${spring.framework.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
          &lt;version&gt;${spring.framework.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
          &lt;version&gt;${spring.framework.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
          &lt;artifactId&gt;spring-data-jpa&lt;/artifactId&gt;
          &lt;version&gt;${spring.framework.data.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;
          &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;
          &lt;version&gt;1.2.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j&lt;/artifactId&gt;
          &lt;version&gt;1.2.16&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.5.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.7&lt;/source&gt;
                  &lt;target&gt;1.7&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>
  
  <p>Dependency Tree (updated to Spring Data 1.5.2, still same issue):</p>
  
  <pre><code>[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ test-spring-transactional ---
  [INFO] com.test.spring.template:test-spring-transactional:jar:1.0.1
  [INFO] +- org.hibernate:hibernate-entitymanager:jar:4.3.5.Final:compile
  [INFO] |  +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
  [INFO] |  +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
  [INFO] |  +- org.hibernate:hibernate-core:jar:4.3.5.Final:compile
  [INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
  [INFO] |  |  \- org.jboss:jandex:jar:1.1.0.Final:compile
  [INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
  [INFO] |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
  [INFO] |  +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.4.Final:compile
  [INFO] |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
  [INFO] |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:compile
  [INFO] |  \- org.javassist:javassist:jar:3.18.1-GA:compile
  [INFO] +- javax.validation:validation-api:jar:1.0.0.GA:compile
  [INFO] +- org.springframework:spring-test:jar:4.0.2.RELEASE:test
  [INFO] |  \- org.springframework:spring-core:jar:4.0.2.RELEASE:compile
  [INFO] |     \- commons-logging:commons-logging:jar:1.1.3:compile
  [INFO] +- org.springframework:spring-context-support:jar:4.0.2.RELEASE:compile
  [INFO] |  \- org.springframework:spring-beans:jar:4.0.2.RELEASE:compile
  [INFO] +- org.springframework:spring-aop:jar:4.0.2.RELEASE:compile
  [INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
  [INFO] +- org.springframework:spring-orm:jar:4.0.2.RELEASE:compile
  [INFO] |  +- org.springframework:spring-jdbc:jar:4.0.2.RELEASE:compile
  [INFO] |  \- org.springframework:spring-tx:jar:4.0.2.RELEASE:compile
  [INFO] +- org.springframework:spring-context:jar:4.0.2.RELEASE:compile
  [INFO] |  \- org.springframework:spring-expression:jar:4.0.2.RELEASE:compile
  [INFO] +- org.springframework.data:spring-data-jpa:jar:1.5.2.RELEASE:compile
  [INFO] |  +- org.springframework.data:spring-data-commons:jar:1.7.2.RELEASE:compile
  [INFO] |  +- org.aspectj:aspectjrt:jar:1.7.4:compile
  [INFO] |  +- org.slf4j:slf4j-api:jar:1.7.6:compile
  [INFO] |  \- org.slf4j:jcl-over-slf4j:jar:1.7.6:runtime
  [INFO] +- commons-dbcp:commons-dbcp:jar:1.2.2:compile
  [INFO] |  \- commons-pool:commons-pool:jar:1.3:compile
  [INFO] \- log4j:log4j:jar:1.2.16:compile
  </code></pre>
  
  <p><strong>**Update based upon responses below to update to Spring Data JPA 1.5.2**</strong></p>
  
  <p>Updating to JPA 1.5.2 "may" have resolved the above issue (as the XML is no longer complaining about referencing a private method), but still has reference issues. Now my repository cannot find the "PagingAndSorting" repository that is referenced by JpaRepository (although it can find JpaRepository itself):</p>
  
  <pre><code>package com.fedins.template.repository;
  
  import org.springframework.data.jpa.repository.JpaRepository;
  
  import com.fedins.template.model.Account;
  
  public interface AccountRespository extends JpaRepository&lt;Account, String&gt; {
  
  }
  </code></pre>
  
  <p>2 errors in this interface:</p>
  
  <pre><code>(base class error)
  The type org.springframework.data.domain.Sort cannot be resolved. It is indirectly referenced from required .class files 
  
  (error on JpaRepository declaration)
  The type org.springframework.data.repository.PagingAndSortingRepository cannot be resolved. It is indirectly referenced from required .class files
  </code></pre>
  
  <p><strong>**Final Update**</strong>
  The issue above was a problem with the local Maven repository. After resolving that, I ended up with a clean project... Except for a final error on the jpa:repositories element:</p>
  
  <pre><code>AnnotationConfigUtils.processCommonDefinitionAnnotations(…) is not public! Make sure you're using Spring 3.2.5 or better. The class was loaded from file:/C:/Program Files/STS/3.4/plugins/org.springframework.context_4.0.0.20130829-M3.jar.:org.springframework.context.annotation.AnnotationConfigUtils.processCommonDefinitionAnnotations(org.springframework.beans.factory.annotation.AnnotatedBeanDefinition)
  </code></pre>
  
  <p>After some searching, I found this may be an issue with STS 3.4: <a href="https://jira.spring.io/i#browse/DATAJPA-490" rel="nofollow">https://jira.spring.io/i#browse/DATAJPA-490</a>
  I will be upgrading to STS 3.5 to see if it solves the issue.</p>