Uploaded image for project: 'Red Hat Data Grid'
  1. Red Hat Data Grid
  2. JDG-114

JGroups incompatible with jboss-logging in EAP 6.4

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • JDG 7.0.0 ER8
    • JDG 7.0.0 ER2
    • JGroups
    • None

    Description

      When testing JDG 7.0.0.ER2, came across this issue: when configuring cache with default transport using:

      GlobalConfiguration globalConfig = new GlobalConfigurationBuilder().transport().defaultTransport()
      

      or even

      GlobalConfiguration globalConfig = new GlobalConfigurationBuilder().transport().transport(new JGroupsTransport())
      

      and running it in EAP 6.4, I get following exception:

      org.infinispan.manager.EmbeddedCacheManagerStartupException: org.infinispan.commons.CacheException: Unable to invoke method public void org.infinispan.remoting.transport.jgroups.JGroupsTransport.start() on object of type JGroupsTransport
      	at org.jgroups.logging.LogFactory.<clinit>(LogFactory.java:28)
      	at org.jgroups.conf.XmlConfigurator.<clinit>(XmlConfigurator.java:35)
      	at org.jgroups.conf.ConfiguratorFactory.getStackConfigurator(ConfiguratorFactory.java:62)
      	at org.jgroups.JChannel.<init>(JChannel.java:129)
      	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.buildChannel(JGroupsTransport.java:448)
      	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.initChannel(JGroupsTransport.java:320)
      	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.initChannelAndRPCDispatcher(JGroupsTransport.java:366)
      	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.start(JGroupsTransport.java:190)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:168)
      	at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:859)
      	at org.infinispan.factories.AbstractComponentRegistry.invokeStartMethods(AbstractComponentRegistry.java:628)
      	at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:617)
      	at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:542)
      	at org.infinispan.factories.GlobalComponentRegistry.start(GlobalComponentRegistry.java:234)
      	at org.infinispan.manager.DefaultCacheManager.start(DefaultCacheManager.java:663)
      	at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:232)
      	at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:186)
      

      I debugged it few hours and here I summarize my findings.
      The first thing is that EAP 6.4 sets JGroups property "jgroups.logging.log_factory_class" in JGroupsExtension, see the code below:

      // Workaround for JGRP-1475
          // Configure JGroups to use jboss-logging.
          static {
              PrivilegedAction<Void> action = new PrivilegedAction<Void>() {
                  @Override
                  public Void run() {
                      if (System.getProperty(Global.CUSTOM_LOG_FACTORY) == null) {
                          System.setProperty(Global.CUSTOM_LOG_FACTORY, LogFactory.class.getName());
                      }
                      return null;
                  }
              };
              AccessController.doPrivileged(action);
          }
      

      This results in ClassNotFoundException of org.jboss.as.clustering.jgroups.LogFactory. The basic cause of this is probably the fact that EAP sets up the property for its own internal JGroups, however affecting the JGroups in deployment.

      To workaround it, use have to reset the property, e.g. calling this before setting up the configuration

      System.clearProperty("jgroups.logging.log_factory_class")
      

      After this, exception changes and the code fails in JGroupsTransport.waitForView, when it tries to call log.tracef. After investigation, JDG 7.0.0.ER2 requires jboss-logging of version 3.3.0.Final, whereas EAP 6.4 provides 3.1.4.Final and those versions are probably clashing. Hence, the EAP's 6.4 jboss-logging must be excluded.

      To summarize the workaround:

      • reset the system property jgroups.logging.log_factory_class" before configuration is built
      • exclude jboss-logging module from EAP 6.4 and add the jboss-logging of version from infinispan-bom to the deployment. Exclusion can be done with the jboss-deployment-structure.xml below:
        <jboss-deployment-structure>
            <deployment>
                <exclusions>
                    <module name="org.jboss.logging" />
                </exclusions>
            </deployment>
        </jboss-deployment-structure>
        

      This issue is not present with EAP 7, since the code in JGroupsExtensions changed.

      Attachments

        Issue Links

          Activity

            People

              slaskawi@redhat.com Sebastian Łaskawiec (Inactive)
              jholusa Jiří Holuša (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: