Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
None
Description
When defining Geode Properties and using the API to start a Geode Server connecting to an existing Locator, if the hostname of the Locator is incorrectly typed, Geode will throw a NullPointerException.
For instance, if I define Geode Properties using...
... private static Properties gemfireProperties() { Properties gemfireProperties = new Properties(); gemfireProperties.setProperty("name", "SessionGeodeServer"); gemfireProperties.setProperty("log-level", LOG_LEVEL); gemfireProperties.setProperty("locators", "loclhost[10334]"); gemfireProperties.setProperty("jmx-manager", "true"); gemfireProperties.setProperty("jmx-manager-start", "true"); gemfireProperties.setProperty("start-locator", "localhost[10334]"); return gemfireProperties; } private static Cache gemfireCache(Properties gemfireProperties) { return new CacheFactory(gemfireProperties).create(); } ...
And, as you can see, I mistyped "localhost" as "loclhost" in gemfireProperties.setProperty("locators", "loclhost[10334]");, this results in...
Exception in thread "main" java.lang.NullPointerException
at org.apache.geode.distributed.internal.membership.gms.GMSUtil.parseLocators(GMSUtil.java:91)
at org.apache.geode.distributed.internal.membership.gms.locator.GMSLocator.<init>(GMSLocator.java:109)
at org.apache.geode.distributed.internal.membership.gms.GMSMemberFactory.newLocatorHandler(GMSMemberFactory.java:125)
at org.apache.geode.distributed.internal.membership.MemberFactory.newLocatorHandler(MemberFactory.java:100)
at org.apache.geode.distributed.internal.InternalLocator.startPeerLocation(InternalLocator.java:537)
at org.apache.geode.distributed.internal.InternalDistributedSystem.startInitLocator(InternalDistributedSystem.java:867)
at org.apache.geode.distributed.internal.InternalDistributedSystem.initialize(InternalDistributedSystem.java:749)
at org.apache.geode.distributed.internal.InternalDistributedSystem.newInstance(InternalDistributedSystem.java:355)
at org.apache.geode.distributed.internal.InternalDistributedSystem.newInstance(InternalDistributedSystem.java:343)
at org.apache.geode.distributed.internal.InternalDistributedSystem.newInstance(InternalDistributedSystem.java:335)
at org.apache.geode.distributed.DistributedSystem.connect(DistributedSystem.java:211)
at org.apache.geode.cache.CacheFactory.create(CacheFactory.java:219)
at example.tests.geode.SessionGeodeServer.gemfireCache(SessionGeodeServer.java:70)
at example.tests.geode.SessionGeodeServer.main(SessionGeodeServer.java:52)
Even worse, if I had not set my log-level to at least "warn" (e.g. suppose I set the log-level to "error") I would possibly never have seen these warning messages...
[warn 2018/12/06 10:14:34.365 PST <main> tid=0x1] Unknown locator host: loclhost [warn 2018/12/06 10:14:34.367 PST <main> tid=0x1] Unknown locator host: loclhost
Attachments
Issue Links
- is duplicated by
-
GEODE-7167 Geode incorrectly parses the 'locators' property throwing a NullPointerException
- Closed