geode-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Burcham (Jira)" <j...@apache.org>
Subject [jira] [Created] (GEODE-7167) Geode incorrectly parses the 'locators' property throwing a NullPointerException
Date Fri, 06 Sep 2019 18:02:00 GMT
Bill Burcham created GEODE-7167:
-----------------------------------

             Summary: Geode incorrectly parses the 'locators' property throwing a NullPointerException
                 Key: GEODE-7167
                 URL: https://issues.apache.org/jira/browse/GEODE-7167
             Project: Geode
          Issue Type: Bug
          Components: membership
            Reporter: Bill Burcham


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...

{code:java}
...

  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();
  }

...
{code}

And, as you can see, I mistyped "localhost" as "loclhost" in {{gemfireProperties.setProperty("locators",
"loclhost[10334]");}}, this results in...

{code:java}
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)
{code}

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...

{code:java}
[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
{code}




--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Mime
View raw message