javaglassfishguavaglassfish-embedded

How to deal with classpath conflict


In my project, I'm using both glassfish-embedded 3.1.1 and the guava lib... The problem is that glassfish comes with the old implementation of guava (ie google-collections)...

This results in NoSuchMethodError at runtime, for example when using Lists.reverse(), or Sets.newIdentityHashSet() which were introduced later in guava.

I don't find any solution to solve this... (the only one is to manually trash the com/google classes directory in the glassfish jar...)


Solution

  • Glassfish should never have included com.google classes in their own jar. That was an error.

    UPDATE[@sly7_7]: It seems like glassfish does not include guava in their own jar anymore, but it depends on the guava artifact instead. This should resolve the problem. Thanks to @JagWire for pointing this.