When Remote Query feature is used through camel-jbossdatagrid component in EAP, and JDG modules for EAP are installed, the application throws java.lang.LinkageError and the Remote Query feature does not work properly. The workaround is to include all dependencies in the deployment (instead of EAP modules). The required dependencies are: camel-jbossdatagrid.jar,
camel-core.jar, infinispan-commons.jar, infinispan-core.jar, jboss-marshalling.jar, jboss-marshalling-river.jar, jgroups.jar
jboss-logging.jar, jboss-transaction-api_1.1_spec.jar, infinispan-client-hotrod.jar, commons-pool.jar, infinispan-query-dsl.jar, infinispan-remote-query-client.jar, protostream.jar.
I'm running InfinispanRemoteQueryProducerIT inside EAP and root cause looks like this (full stacktrace attached:
Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "org/infinispan/query/dsl/QueryFactory"
at org.apache.camel.component.infinispan.InfinispanRemoteQueryProducerIT$5$1.build(InfinispanRemoteQueryProducerIT.java:212) [camel-jbossdatagrid-tests.jar:6.5.0.ER2-redhat-1]
at org.apache.camel.component.infinispan.InfinispanOperation$Operation.getQuery(InfinispanOperation.java:114) [camel-jbossdatagrid.jar:6.5.0.ER2-redhat-1]
at org.apache.camel.component.infinispan.InfinispanOperation$Operation$5.execute(InfinispanOperation.java:84) [camel-jbossdatagrid.jar:6.5.0.ER2-redhat-1]
at org.apache.camel.component.infinispan.InfinispanOperation.process(InfinispanOperation.java:39) [camel-jbossdatagrid.jar:6.5.0.ER2-redhat-1]
at org.apache.camel.component.infinispan.InfinispanProducer.process(InfinispanProducer.java:42) [camel-jbossdatagrid.jar:6.5.0.ER2-redhat-1]
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) [camel-core.jar:2.12.0.redhat-610379]
... 124 more
I'm using jboss-deployment-structure.xml:
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.infinispan" slot="${datagrid.slot}" />
<module name="org.jgroups" slot="${datagrid.slot}" />
<module name="org.infinispan.client.hotrod" slot="${datagrid.slot}" />
<module name="org.infinispan.protostream" slot="${datagrid.slot}" />
<module name="org.infinispan.query.remote.client" slot="${datagrid.slot}" />
<module name="org.infinispan.protostream.sample-domain-definition" slot="${datagrid.slot}" />
<module name="org.infinispan.protostream.sample-domain-implementation" slot="${datagrid.slot}" />
</dependencies>
</deployment>
</jboss-deployment-structure>
and libraries such as camel-core, camel-jbossdatagrid are deployed inside the application.
The camel-jbossdatagrid component requires both infinispan-embedded and infinispan-remote on classpath and when I package these libraries in the war file, the deployment into EAP fails due to https://bugzilla.redhat.com/show_bug.cgi?id=1175272. I'm not able to run the tests, logically. The workaround would be to use individual jar files (the old way), and not uber-jars.
Yay!
I was able to run all tests for camel-jbossdatagrid in EAP 6.4, including remote query and custom even listeners.
The following set of dependencies has to be used instead of uber-jars (so it's a workaround):
camel-jbossdatagrid.jar
camel-core.jar
infinispan-commons.jar
infinispan-core.jar
jboss-marshalling.jar
jboss-marshalling-river.jar
jgroups.jar
jboss-logging.jar
jboss-transaction-api_1.1_spec.jar
infinispan-client-hotrod.jar
commons-pool.jar
infinispan-query-dsl.jar
infinispan-remote-query-client.jar
protostream.jar
What PR? This still needs to be fixed as the preferred way is to use uber-jars. What I described is basically a workaround. I have the modified tests in my local branch but don't want to push them to github.
I'm running InfinispanRemoteQueryProducerIT inside EAP and root cause looks like this (full stacktrace attached: Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "org/infinispan/query/dsl/QueryFactory" at org.apache.camel.component.infinispan.InfinispanRemoteQueryProducerIT$5$1.build(InfinispanRemoteQueryProducerIT.java:212) [camel-jbossdatagrid-tests.jar:6.5.0.ER2-redhat-1] at org.apache.camel.component.infinispan.InfinispanOperation$Operation.getQuery(InfinispanOperation.java:114) [camel-jbossdatagrid.jar:6.5.0.ER2-redhat-1] at org.apache.camel.component.infinispan.InfinispanOperation$Operation$5.execute(InfinispanOperation.java:84) [camel-jbossdatagrid.jar:6.5.0.ER2-redhat-1] at org.apache.camel.component.infinispan.InfinispanOperation.process(InfinispanOperation.java:39) [camel-jbossdatagrid.jar:6.5.0.ER2-redhat-1] at org.apache.camel.component.infinispan.InfinispanProducer.process(InfinispanProducer.java:42) [camel-jbossdatagrid.jar:6.5.0.ER2-redhat-1] at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) [camel-core.jar:2.12.0.redhat-610379] ... 124 more I'm using jboss-deployment-structure.xml: <jboss-deployment-structure> <deployment> <dependencies> <module name="org.infinispan" slot="${datagrid.slot}" /> <module name="org.jgroups" slot="${datagrid.slot}" /> <module name="org.infinispan.client.hotrod" slot="${datagrid.slot}" /> <module name="org.infinispan.protostream" slot="${datagrid.slot}" /> <module name="org.infinispan.query.remote.client" slot="${datagrid.slot}" /> <module name="org.infinispan.protostream.sample-domain-definition" slot="${datagrid.slot}" /> <module name="org.infinispan.protostream.sample-domain-implementation" slot="${datagrid.slot}" /> </dependencies> </deployment> </jboss-deployment-structure> and libraries such as camel-core, camel-jbossdatagrid are deployed inside the application.