• Type: Bug
    • Status: New (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 9.4.4.Final
    • Fix Version/s: None
    • Component/s: Listeners
    • Labels:


      We have a malfunction that we think is a bug but are not sure whether it is a JBoss, HornetQ or Infinspan issue. Here is the situation:
      Two war applications on one JBoss, one sends data into a JMS queue, the other consumes them. On startup, each application registers in a replicated Infinispan cache.
      Infinispan subsystem is excluded in jboss-deployment-structure.xml and libs are in the lib folder of the applications. When we start JBoss and both applications are deployed simultaneously,
      all is okay. When first the consuming app is deployed and then the sending app we observe following error in last line of the following code in MessageListener:

      	public void process(Message inMessage) {
      		DistributionMetadata metadata = null;"DistributionMetadata.class.getClassLoader().toString(): " + DistributionMetadata.class.getClassLoader().toString());
      		try {
      			Object obj = ((ObjectMessage) inMessage).getObject();"obj.getClass().getClassLoader().toString(): " + obj.getClass().getClassLoader().toString());
      			metadata = (DistributionMetadata) obj;

      INFO 12:01:41,805 (Thread-9 (HornetQ-client-global-threads-1054694434)) ( -
      DistributionMetadata.class.getClassLoader().toString(): ModuleClassLoader for Module "deployment.msp.war:main" from Service Module Loader

      obj.getClass().getClassLoader().toString(): ModuleClassLoader for Module "deployment.bvn-idx-routing.war:main" from Service Module Loader
      ERROR 12:01:41,805 (Thread-9 (HornetQ-client-global-threads-1054694434)) ( -FAILED: com.equensworldline.jms.entities.DistributionMetadata cannot be cast to com.equensworldline.jms.entities.DistributionMetadata: java.lang.ClassCastException: com.equensworldline.jms.entities.DistributionMetadata cannot be cast to com.equensworldline.jms.entities.DistributionMetadata
      at com.equensworldline.jms.api.external.JmsConsumer.process(
      at com.equensworldline.correlationidmgmt.jee.CorrelationIDMessageListener.onMessage(
      at org.hornetq.jms.client.JMSMessageListenerWrapper.onMessage(
      at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(
      at org.hornetq.core.client.impl.ClientConsumerImpl.access$500(
      at org.hornetq.core.client.impl.ClientConsumerImpl$
      at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$
      at java.util.concurrent.ThreadPoolExecutor.runWorker(
      at java.util.concurrent.ThreadPoolExecutor$

      You see the DistributionMetadata class is loaded by two different classloaders which causes this error.

      The remedy we found is very strange and has on first sight nothing to do with the failure:
      We have registered an Infinispan cachelistener and within the @CacheEntryCreated event we start a JMS listener and access the cache. Because we observed org.infinispan.util.concurrent.TimeoutException
      we make this asynchronously following the advice in

      CompletableFuture.runAsync(() -> regService.startListener(event.getValue()));

      When we change back to a synchronous call, everything works and the ClassCastException does not occur. It seems, either Infinispan, HornetQ or JBoss does something queer with the classloaders in the described situation

        Gliffy Diagrams




              • Assignee:
                wwinter worldline_ge_dev worldline_ge_dev
              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: