Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-6522

Cannot use @DateBridge with WildFly modules: java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter

XMLWordPrintable

      The Hibernate Search engine detects if the elasticsearch backend is on the classpath,
      and if so, adds o.h.s.backend.elasticsearch.impl.ElasticsearchBridgeProvider to the top of the list of the annotation based bridge providers.

      When processing an entity with a @DateBridge annotation, it picks the elasticsearch provider to converted from/to Date objects (since it has priority) which in turn fails with the exception:

      org.infinispan.commons.CacheException: java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
      	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
      	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
      	at org.hibernate.search.backend.elasticsearch.impl.ElasticsearchBridgeProvider$EsDateBridge.convertToString(ElasticsearchBridgeProvider.java:71)
      	at org.hibernate.search.backend.elasticsearch.impl.ElasticsearchBridgeProvider$EsDateBridge.set(ElasticsearchBridgeProvider.java:54)
      	at org.hibernate.search.bridge.util.impl.ContextualExceptionBridgeHelper$OneWayConversionContextImpl.set(ContextualExceptionBridgeHelper.java:110)
      	at org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.buildDocumentFieldsForProperties(DocumentBuilderIndexedEntity.java:626)
      

      This exception happens only when using the infinispan modules, where the elasticsearch backend is added as a dependency; in embedded mode the aforementioned provider is not loaded since the elasticsearch is not on the classpath.

      This current behaviour is not the best for two reasons:

      • When using Wildlfy modules, the elasticsearch backend is marked as optional, but still, it's visible in the classpath and gets loaded
      • If the user is not using the elasticsearch backend, but the jar is on the classpath, elasticsearch date conversion will take precedence over the built-in bridge providers, and it shouldn't

              gfernand@redhat.com Gustavo Fernandes (Inactive)
              gfernand@redhat.com Gustavo Fernandes (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: