OSGi r4v4.2 (chap. 127.1.3) defines the JPA versions as:
| JPA | Packages | Export Version | Client Import Range | Provider Imp. Range | ----------- -------------------------- -------------------- -------------------------- ---------------------------- | JPA 1.0 | javax.persistence | 1.0 | [1.0,2.0) | [1.0,1.1) | | | javax.persistence.spi | 1.0 | [1.0,2.0) | [1.0,1.1) | | JPA 2.0 | javax.persistence | 1.1 | [1.1,2.0) | [1.1,1.2) | | | javax.persistence.spi | 1.1 | [1.1,2.0) | [1.1,1.2) |
Compliant SPIs export as 1.1, so the import for javax.persistence should be [1.1.0,3.0.0) instead of [2.0.0,3.0.0).
In my case, DefaultTraversableResolver happens to find the 2.0 environment using reflection (since JPA2 is available in the classpath), but later fails with NoClassDefFoundError because of the wrong version import.
|