Bug 1213749

Summary: Camel throwing java.lang.LinkageError for Remote Query when running in EAP
Product: [JBoss] JBoss Data Grid 6 Reporter: Martin Gencur <mgencur>
Component: Camel-JBossDataGridAssignee: Adrian Nistor <anistor>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Gencur <mgencur>
Severity: high Docs Contact:
Priority: high    
Version: 6.5.0CC: anistor, dmehra, jdg-bugs, pzapataf, rmarwaha, slaskawi, ttarrant
Target Milestone: ER4   
Target Release: 6.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
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.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-23 12:24:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
full-stacktrace none

Description Martin Gencur 2015-04-21 08:33:59 UTC
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.

Comment 1 Martin Gencur 2015-04-21 08:35:36 UTC
Created attachment 1016741 [details]
full-stacktrace

Comment 3 Ion Savin 2015-04-22 14:07:24 UTC
You probably need also:

<module name="org.infinispan.query.dsl" slot="${datagrid.slot}" />

Comment 4 Martin Gencur 2015-04-22 14:15:53 UTC
Maybe, but it does not help in this case. I tried that.

Comment 5 Martin Gencur 2015-04-29 16:12:32 UTC
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.

Comment 6 Martin Gencur 2015-04-30 07:03:22 UTC
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

Comment 7 Ion Savin 2015-04-30 08:15:44 UTC
Would you mind opening a PR if you already have the changes ready and tested?

Comment 8 Martin Gencur 2015-04-30 08:18:34 UTC
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.