]
Adrian Nistor updated ISPN-6522:
--------------------------------
Status: Resolved (was: Pull Request Sent)
Resolution: Done
Integrated in master and 8.2.x. Thanks [~gustavonalle]!
Cannot use @DateBridge with WildFly modules:
java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
-------------------------------------------------------------------------------------------------------------
Key: ISPN-6522
URL:
https://issues.jboss.org/browse/ISPN-6522
Project: Infinispan
Issue Type: Bug
Components: Embedded Querying, WildFly modules
Affects Versions: 8.2.1.Final, 9.0.0.Alpha1
Reporter: Gustavo Fernandes
Assignee: Gustavo Fernandes
Priority: Critical
Fix For: 9.0.0.Alpha3, 8.2.3.Final
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:
{code}
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)
{code}
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