Reputation: 11
This problem started strange: I used org.jsr107.ri library in my application.
When I started my application, using gradle, everything was fine, but when I built a war file and deployed it on my tomcat server, I got the exception:
java.util.ServiceConfigurationError: javax.cache.spi.CachingProvider: Provider org.jsr107.ri.spi.RICachingProvider could not be instantiated
...
Caused by: java.lang.IncompatibleClassChangeError: Implementing class
After some investigation, I found, that I have an interface javax.cache.CacheManager in cache-api-1.0.0.jar library, and the class javax.cache.CacheManager in the appengine-api-1.0-sdk-1.9.57.jar library.
When I removed javax.cache.* from this library (or even renamed the appengine-api-1.0-sdk-1.9.57.jar to zappengine-api-1.0-sdk-1.9.57.jar to change the order of loading classes), my application started to work fine, but this solution looks awful(for me).
I opened a JSR107 specification (http://download.oracle.com/otn-pub/jcp/jcache-1_0-fr-spec/JSR107FinalSpecification.pdf), and found, that CacheManager interface should be used.
Is there a good solution of this problem? Is there a appengine-api-1.0-sdk-1.9.57.jar file without the javax.cache (and, probably, javax.mail)libraries?
Upvotes: 1
Views: 244
Reputation: 11
Add below tag in your appengine-web.xml
<class-loader-config>
<priority-specifier filename="cache-api-1.1.1.jar"/>
</class-loader-config>
I faced the same issue and got resolved by above. For the reference checkout the GCP page. https://cloud.google.com/appengine/docs/standard/java/runtime
Upvotes: 1
Reputation: 127
Happened to me a year ago as well. The problem is GAE is NOT JCache compliant. It supports a proposed draft release of JCache but not final. Google banked on the standard not changing and implemented against the draft. Unfortunately for the entire Java community of GAE fans JCache on GAE is effectively useless to us.
Upvotes: 1