Fuse is not starting correct if the JDG HotRod client is used inside of the application

Solution Verified - Updated -

Issue

With a clean installation an installation of the infinispan-client-hotrod-with-query Karaf feature works fine.
However if I shut down and restart the whole Fuse instance then the services refuse to start, and throwing the following exception. There seems to be some problem with org.infinispan.commons.util.OsgiClassLoader.

 INFO  [org.jboss.as] (MSC service thread 1-7) WFLYSRV0049:
ERROR BlueprintContainerImpl Unable to start blueprint container for bundle com.redhat.test/0.0.1.SNAPSHOT
org.osgi.service.blueprint.container.ComponentDefinitionException: Error when instantiating bean cacheFactory of class com.redhat.hotrod.RemoteCacheFactory
    at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:333)
    ...
Caused by: java.lang.RuntimeException: Unable to call getInstance on OsgiClassLoader
    at org.infinispan.commons.util.Util.getOSGiClassLoader(Util.java:155)
    at org.infinispan.commons.util.Util.getClassLoaders(Util.java:132)
    at org.infinispan.commons.util.Util.loadClassStrict(Util.java:176)
    at org.infinispan.commons.util.Util.loadClass(Util.java:114)
    at org.infinispan.client.hotrod.configuration.ConfigurationBuilder.balancingStrategy(ConfigurationBuilder.java:127)
    at org.infinispan.client.hotrod.configuration.ConfigurationBuilder.withProperties(ConfigurationBuilder.java:301)
    ...
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_112]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_112]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_112]
    at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_112]
    at org.infinispan.commons.util.Util.getOSGiClassLoader(Util.java:150)
    ... 120 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.infinispan.commons.util.OsgiClassLoader$LazyHolder
    at org.infinispan.commons.util.OsgiClassLoader.getInstance(OsgiClassLoader.java:40)
    ... 125 more

Tracking down the first occurrence of the exception when Fuse starts, and there is a little more info in the stack trace

Caused by: org.osgi.service.blueprint.container.ComponentDefinitionException: Error when instantiating bean cacheFactory of class com.redhat.hotrod.RemoteCacheFactory
    at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:333)[23:org.apache.aries.blueprint.core:1.4.4]
    ...
Caused by: java.lang.RuntimeException: Unable to call getInstance on OsgiClassLoader
    at org.infinispan.commons.util.Util.getOSGiClassLoader(Util.java:155)
    at org.infinispan.commons.util.Util.getClassLoaders(Util.java:132)
    at org.infinispan.commons.util.Util.loadClassStrict(Util.java:176)
    at org.infinispan.commons.util.Util.loadClass(Util.java:114)
    at org.infinispan.client.hotrod.configuration.ConfigurationBuilder.balancingStrategy(ConfigurationBuilder.java:127)
    at org.infinispan.client.hotrod.configuration.ConfigurationBuilder.withProperties(ConfigurationBuilder.java:301)
    ...
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_112]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_112]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_112]
    at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_112]
    at org.infinispan.commons.util.Util.getOSGiClassLoader(Util.java:150)
    ... 98 more
Caused by: java.lang.ExceptionInInitializerError
    at org.infinispan.commons.util.OsgiClassLoader.getInstance(OsgiClassLoader.java:40)
    ... 103 more
Caused by: java.lang.NullPointerException
    at org.infinispan.commons.util.OsgiClassLoader.<init>(OsgiClassLoader.java:51)
    at org.infinispan.commons.util.OsgiClassLoader.<init>(OsgiClassLoader.java:20)
    at org.infinispan.commons.util.OsgiClassLoader$LazyHolder.<clinit>(OsgiClassLoader.java:36)
    ... 104 more

From the feature file and package imports there is a dependency hierarchy from app bundle -> hotrod client -> infinispan commons,
so I would have thought Karaf should figure out the start order?

Environment

  • JBoss Fuse 6
  • Karaf
  • Red Hat JBoss Data Grid (JDG)

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.