[infinispan-issues] [JBoss JIRA] (ISPN-6522) Cannot use @DateBridge with WildFly modules: java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter

Gustavo Fernandes (JIRA) issues at jboss.org
Wed Apr 20 12:46:00 EDT 2016


Gustavo Fernandes created ISPN-6522:
---------------------------------------

             Summary: 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: 9.0.0.Alpha1, 8.2.1.Final
            Reporter: Gustavo Fernandes


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



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the infinispan-issues mailing list