-
Enhancement
-
Resolution: Done
-
Minor
-
5.1.2.FINAL
Took me a long to figure this out, so I'm creating an issue for it.
When initializing an EmbeddedCacheManager with a transport (jGroups) configuration file that does not exist the following exception is eventually given:
at org.infinispan.factories.GlobalComponentRegistry.start(GlobalComponentRegistry.java:222)
at org.infinispan.manager.DefaultCacheManager.wireCache(DefaultCacheManager.java:654)
at org.infinispan.manager.DefaultCacheManager.createCache(DefaultCacheManager.java:619)
at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:516)
at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:489)
[...]
Caused by: org.infinispan.CacheException: Unable to invoke method public void org.infinispan.remoting.transport.jgroups.JGroupsTransport.start() on object
at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:238)
at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:882)
at org.infinispan.factories.AbstractComponentRegistry.invokeStartMethods(AbstractComponentRegistry.java:637)
at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:626)
at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:530)
at org.infinispan.factories.GlobalComponentRegistry.start(GlobalComponentRegistry.java:200)
... 38 more
Caused by: org.infinispan.CacheException: java.lang.NullPointerException: the specifed protocol stack configuration was null
at org.infinispan.remoting.transport.jgroups.JGroupsTransport.buildChannel(JGroupsTransport.java:333)
at org.infinispan.remoting.transport.jgroups.JGroupsTransport.initChannel(JGroupsTransport.java:252)
at org.infinispan.remoting.transport.jgroups.JGroupsTransport.initChannelAndRPCDispatcher(JGroupsTransport.java:292)
at org.infinispan.remoting.transport.jgroups.JGroupsTransport.start(JGroupsTransport.java:170)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:236)
... 43 more
Caused by: java.lang.NullPointerException: the specifed protocol stack configuration was null
at org.jgroups.conf.ConfiguratorFactory.checkForNullConfiguration(ConfiguratorFactory.java:228)
at org.jgroups.conf.ConfiguratorFactory.getStackConfigurator(ConfiguratorFactory.java:60)
at org.jgroups.JChannel.<init>(JChannel.java:136)
at org.infinispan.remoting.transport.jgroups.JGroupsTransport.buildChannel(JGroupsTransport.java:330)
... 51 more
I guess the reason why the exception is given first when DefaultCacheManager.getCache(...) is called, is because it is initialized lazily. Sadly, this goes against "Fail early" and it would be useful if the file could not be read at configuration time.
Also, if the file cannot be found/read there should a be a separate Exception thrown for this that states that fact.