Details

    • 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:
      None

      Description

      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;
      		log.info("DistributionMetadata.class.getClassLoader().toString(): " + DistributionMetadata.class.getClassLoader().toString());
      
      		try {
      			Object obj = ((ObjectMessage) inMessage).getObject();
      			log.info("obj.getClass().getClassLoader().toString(): " + obj.getClass().getClassLoader().toString());
      			metadata = (DistributionMetadata) obj;
      

      INFO 12:01:41,805 (Thread-9 (HornetQ-client-global-threads-1054694434)) (JmsConsumer.java:process:214) -
      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)) (JmsConsumer.java:process:244) -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(JmsConsumer.java:217)
      at com.equensworldline.correlationidmgmt.jee.CorrelationIDMessageListener.onMessage(CorrelationIDMessageListener.java:32)
      at org.hornetq.jms.client.JMSMessageListenerWrapper.onMessage(JMSMessageListenerWrapper.java:100)
      at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:1123)
      at org.hornetq.core.client.impl.ClientConsumerImpl.access$500(ClientConsumerImpl.java:57)
      at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1258)
      at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:105)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)

      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 https://developer.jboss.org/thread/268919.

      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

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated: