Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-9241

NPE when creating caches via HotRod on non-clustered servers

    XMLWordPrintable

Details

    Description

      The following snipped throws NPE:

      import org.infinispan.client.hotrod.RemoteCache;
      import org.infinispan.client.hotrod.RemoteCacheManager;
      import org.infinispan.client.hotrod.configuration.ConfigurationBuilder;
      import org.infinispan.commons.configuration.XMLStringConfiguration;
      
      public class Demo {
      
         public static void main(String[] args) {
            org.infinispan.client.hotrod.configuration.Configuration build = new ConfigurationBuilder().build();
            RemoteCacheManager rcm = new RemoteCacheManager(build);
            String xml = String.format("<infinispan><cache-container><distributed-cache name=\"%s\"><expiration interval=\"10000\" lifespan=\"10\" max-idle=\"10\"/></distributed-cache></cache-container></infinispan>", "cache");
            RemoteCache<Object, Object> index = rcm.administration().createCache("cache", new XMLStringConfiguration(xml));
            System.out.println(index.size());
         }
      }
      
      java.lang.NullPointerException
      Exception in thread "main" org.infinispan.client.hotrod.exceptions.HotRodClientException:Request for messageId=3 returned server error (status=0x85): org.infinispan.commons.CacheListenerException: ISPN000280: Caught exception [java.lang.NullPointerException] while invoking method [public void org.infinispan.globalstate.impl.GlobalConfigurationStateListener.createCache(org.infinispan.notifications.cachelistener.event.CacheEntryCreatedEvent)] on listener instance: org.infinispan.globalstate.impl.GlobalConfigurationStateListener@37aecb9c
      java.lang.NullPointerException
      	at org.infinispan.client.hotrod.impl.protocol.Codec20.checkForErrorsInResponseStatus(Codec20.java:396)
      	at org.infinispan.client.hotrod.impl.protocol.Codec20.readPartialHeader(Codec20.java:183)
      	at org.infinispan.client.hotrod.impl.protocol.Codec20.readHeader(Codec20.java:169)
      	at org.infinispan.client.hotrod.impl.transport.netty.HeaderDecoder.decode(HeaderDecoder.java:85)
      	at org.infinispan.client.hotrod.impl.transport.netty.HintedReplayingDecoder.callDecode(HintedReplayingDecoder.java:98)
      	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
      	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
      	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
      	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
      	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
      	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
      	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
      	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
      	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1414)
      	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
      	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
      	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:945)
      	at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:806)
      	at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:404)
      	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:304)
      	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      

      on the server:

      Caused by: java.lang.NullPointerException
      	at org.infinispan.cache.impl.CacheImpl.toString(CacheImpl.java:1286)
      	at java.lang.String.valueOf(String.java:2994)
      	at java.lang.StringBuilder.append(StringBuilder.java:131)
      	at org.infinispan.factories.AbstractComponentRegistry.wireDependencies(AbstractComponentRegistry.java:188)
      	at org.infinispan.cache.impl.EncoderCache.wireRealCache(EncoderCache.java:125)
      	at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.infinispan.commons.util.SecurityActions.lambda$invokeAccessibly$0(SecurityActions.java:79)
      	at org.infinispan.commons.util.SecurityActions.doPrivileged(SecurityActions.java:71)
      	at org.infinispan.commons.util.SecurityActions.invokeAccessibly(SecurityActions.java:76)
      	at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:185)
      	at org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:286)
      	at org.infinispan.factories.AbstractComponentRegistry.access$100(AbstractComponentRegistry.java:73)
      	at org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:872)
      	at org.infinispan.factories.AbstractComponentRegistry.registerComponentInternal(AbstractComponentRegistry.java:257)
      	at org.infinispan.factories.ComponentRegistry.registerComponentInternal(ComponentRegistry.java:199)
      	at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:208)
      	at org.infinispan.factories.InternalCacheFactory.bootstrap(InternalCacheFactory.java:154)
      
      

      Attachments

        Activity

          People

            gfernand@redhat.com Gustavo Fernandes
            gfernand@redhat.com Gustavo Fernandes
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: