3

I'm trying to use the infinispan-spring-boot-starter on Java 11, but when the App is started in a jar, it fails with a NoClassDefFoundError.

It works fine if I run it with Java 8. It also works fine if I run it on Java 11 with

    mvn spring-boot:run

but it fails if executed with

   java -jar target/demo-0.0.1-SNAPSHOT.jar

with the following Exception:

    Caused by: org.infinispan.commons.CacheConfigurationException: Failed to construct component org.infinispan.marshall.core.EncoderRegistry, path null
at org.infinispan.factories.impl.BasicComponentRegistryImpl.instantiateWrapper(BasicComponentRegistryImpl.java:141) ~[infinispan-core-9.4.5.Final.jar!/:9.4.5.Final]
at org.infinispan.factories.impl.BasicComponentRegistryImpl.getComponent0(BasicComponentRegistryImpl.java:107) ~[infinispan-core-9.4.5.Final.jar!/:9.4.5.Final]
at org.infinispan.factories.impl.BasicComponentRegistryImpl.getComponent(BasicComponentRegistryImpl.java:73) ~[infinispan-core-9.4.5.Final.jar!/:9.4.5.Final]
at org.infinispan.factories.impl.BasicComponentRegistry.getComponent(BasicComponentRegistry.java:75) ~[infinispan-core-9.4.5.Final.jar!/:9.4.5.Final]
at org.infinispan.factories.GlobalComponentRegistry.<init>(GlobalComponentRegistry.java:158) ~[infinispan-core-9.4.5.Final.jar!/:9.4.5.Final]
... 56 common frames omitted
    Caused by: java.lang.NoClassDefFoundError: org/infinispan/commons/util/FastCopyHashMap$Values (wrong name: org/infinispan/commons/dataconversion/BinaryEncoder)
at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[na:na]
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016) ~[na:na]
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174) ~[na:na]
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:550) ~[na:na]
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458) ~[na:na]
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452) ~[na:na]
at java.base/java.security.AccessController.doPrivileged(Native Method) ~[na:na]
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588) ~[na:na]
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:93) ~[demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
at org.infinispan.factories.EncoderRegistryFactory.construct(EncoderRegistryFactory.java:48) ~[infinispan-core-9.4.5.Final.jar!/:9.4.5.Final]
at org.infinispan.factories.impl.BasicComponentRegistryImpl.instantiateWrapper(BasicComponentRegistryImpl.java:137) ~[infinispan-core-9.4.5.Final.jar!/:9.4.5.Final]
... 60 common frames omitted

My Setup:

  • ubuntu 16.04
  • maven 3.6
  • openjdk 11.0.1

Here you can find a little demo project to show the problem: https://github.com/ben-schroeder/infinispan-ncdfe. Please run it with

mvn clean install
java -jar target/demo-0.0.1-SNAPSHOT.jar

Thanks for any help on the problem. Is it a bug or do I miss something?

3 Answers3

6

Thanks for pointing this. We are investigating the problem with spring-boot team. Here is the Spring-Boot issue we opened

https://github.com/spring-projects/spring-boot/issues/15981

[UPDATE] Spring-Boot 2.1.4.RELEASE released today (04-04-2019) corrects the issue. Please, check the release notes, bug fixes section

https://github.com/spring-projects/spring-boot/releases/tag/v2.1.4.RELEASE

karesti
  • 328
  • 1
  • 5
  • 1
    The issue is coming from Spring-Boot. Here is the correction that will be available in Spring-Boot 2.1.4.RELEASE I guess. https://github.com/spring-projects/spring-boot/commit/68e3de0357cd480ed1384377e31c927f6853cfeb – karesti Feb 18 '19 at 19:22
1

I noticed this as well. Until there's a solution, 9.4.3.Final works fine. The problem is since 9.4.4.

  • 1
    Thanks for the workaround. I opened an issue for this: https://issues.jboss.org/browse/ISPN-9977 – benschroeder Feb 17 '19 at 15:22
  • It works now. Releasing the infinispan starter today. The problem was in 2.1.3.RELEASE. Upgrading to 2.1.4.RELEASE solved the issue – karesti Apr 04 '19 at 08:20
-1

9.4.5 and 9.4.4 also cause this issue.

For someone else suffering the same issue in a gradle build environment, exclude the infinispan transient dependencies from the dependency that pulls them in, and explicitly pull in the 9.4.3 version:

  compile (group: "the.lib.that.pulls.in", name: "the", version: transients) {
    exclude group: 'org.infinispan', module: 'infinispan-core'
    exclude group: 'org.infinispan', module: 'infinispan-client-hotrod'
    exclude group: 'org.infinispan', module: 'infinispan-query-dsl'
    exclude group: 'org.infinispan', module: 'infinispan-commons'
  }
  implementation group: 'org.infinispan', name: 'infinispan-core', version: '9.4.3.Final'
  implementation group: 'org.infinispan', name: 'infinispan-client-hotrod', version: '9.4.3.Final'
  implementation group: 'org.infinispan', name: 'infinispan-query-dsl', version: '9.4.3.Final'
  implementation group: 'org.infinispan', name: 'infinispan-commons', version: '9.4.3.Final'
sweetfa
  • 5,457
  • 2
  • 48
  • 62
  • 2
    You can upgrade to 2.1.4.RELEASE and use the proper version of Infinispan. We are releasing the starter today – karesti Apr 04 '19 at 08:02