• Bug
  • Status: New
  • 2 Major
  • Resolution:
  • drb
  • Reporter: adahanne
  • July 29, 2015
  • 0
  • Watchers: 1
  • October 18, 2016

Description

If you deploy a webapp to Tomcat, that includes its own jax-rs api jar and ehcache-ee, you could trigger a ClassCastException on ClientBuilder :

Caused by: java.lang.LinkageError: ClassCastException: attempting to castjar:file:/C:/dev/apache-tomcat-7.0.16_1/webapps/pendingaccount/WEB-INF/lib/jaxrs-api-3.0.9.Final.jar!/javax/ws/rs/client/ClientBuilder.class to jar:file:/C:/dev/apache-tomcat-7.0.16_1/webapps/pendingaccount/WEB-INF/lib/ehcache-ee-2.10.0.0.26.jar!/rest-management-private-classpath/javax/ws/rs/client/ClientBuilder.class_terracotta at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:97) 

Issue was first reported on SO : http://stackoverflow.com/questions/31542786/terracotta-4-3-jar-conflicts

We shade jaxrs-api classes into a private classpath folder in ehcache, to avoid using the classes provided by the application container (Tomcat here)

According to the stack trace, the management code in ehcache ee (ManagementServerLoader) found a jaxrs api class outside its private classpath and tried to use it. That should not have happened.

Comments

Anthony Dahanne Dahanne 2016-10-18

this stacktrace happened in a particular setup; the underlying exception happened because the client code embedding ehcache is using a class loader interfering with ehcache. I suggest we close this ticket as the stacktrace was triggered by some client code using ehcache; it’s not an issue in ehcache management code.