Skip to content

Instantly share code, notes, and snippets.

@strokine
Created April 21, 2016 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save strokine/1dd575d219c2d90edb91695de829eb45 to your computer and use it in GitHub Desktop.
Save strokine/1dd575d219c2d90edb91695de829eb45 to your computer and use it in GitHub Desktop.
This code demonstrates the problem creating Geode Locator and Server in the same process
import com.gemstone.gemfire.distributed.LocatorLauncher;
import com.gemstone.gemfire.distributed.ServerLauncher;
public class Server {
public static void main(String[] args){
new LocatorLauncher.Builder()
.setBindAddress("localhost")
.setPort(7300)
.build()
.start();
new ServerLauncher.Builder()
.setServerBindAddress("localhost")
.setServerPort(9900)
.set("locators", "localhost[7300]")
.build()
.start();
}
}
@strokine
Copy link
Author

strokine commented Apr 21, 2016

Note, that if you remove line 16, everything would work.
Here is the exception:

Exception in thread "main" java.lang.IllegalStateException: A connection to a distributed system already exists in this VM.  It has the following configuration:
  ack-severe-alert-threshold="0"
  ack-wait-threshold="15"
  archive-disk-space-limit="0"
  archive-file-size-limit="0"
  async-distribution-timeout="0"
  async-max-queue-size="8"
  async-queue-timeout="60000"
  bind-address="127.0.0.1" ***(wanted "")***
  cache-xml-file="" ***(wanted "cache.xml")***
  cluster-configuration-dir="/Users/es/git/ccio/ccio-image"
  cluster-ssl-ciphers="any"
  cluster-ssl-enabled="false"
  cluster-ssl-keystore=""
  cluster-ssl-keystore-password=""
  cluster-ssl-keystore-type=""
  cluster-ssl-protocols="any"
  cluster-ssl-require-authentication="true"
  cluster-ssl-truststore=""
  cluster-ssl-truststore-password=""
  conflate-events="server"
  conserve-sockets="true"
  delta-propagation="true"
  deploy-working-dir="."
  disable-auto-reconnect="false"
  disable-tcp="false"
  distributed-system-id="-1"
  distributed-transactions="false"
  durable-client-id=""
  durable-client-timeout="300"
  enable-cluster-configuration="true"
  enable-network-partition-detection="false"
  enable-time-statistics="false"
  enforce-unique-host="false"
  gateway-ssl-ciphers="any"
  gateway-ssl-enabled="false"
  gateway-ssl-keystore=""
  gateway-ssl-keystore-password=""
  gateway-ssl-keystore-type=""
  gateway-ssl-protocols="any"
  gateway-ssl-require-authentication="true"
  gateway-ssl-truststore=""
  gateway-ssl-truststore-password=""
  groups=""
  http-service-bind-address=""
  http-service-port="7070"
  http-service-ssl-ciphers="any"
  http-service-ssl-enabled="false"
  http-service-ssl-keystore=""
  http-service-ssl-keystore-password=""
  http-service-ssl-keystore-type=""
  http-service-ssl-protocols="any"
  http-service-ssl-require-authentication="false"
  http-service-ssl-truststore=""
  http-service-ssl-truststore-password=""
  jmx-manager="true" ***(wanted "false")***
  jmx-manager-access-file=""
  jmx-manager-bind-address=""
  jmx-manager-hostname-for-clients=""
  jmx-manager-http-port="7070"
  jmx-manager-password-file=""
  jmx-manager-port="1099"
  jmx-manager-ssl="false"
  jmx-manager-ssl-ciphers="any"
  jmx-manager-ssl-enabled="false"
  jmx-manager-ssl-keystore=""
  jmx-manager-ssl-keystore-password=""
  jmx-manager-ssl-keystore-type=""
  jmx-manager-ssl-protocols="any"
  jmx-manager-ssl-require-authentication="true"
  jmx-manager-ssl-truststore=""
  jmx-manager-ssl-truststore-password=""
  jmx-manager-start="false"
  jmx-manager-update-rate="2000"
  load-cluster-configuration-from-dir="false"
  locator-wait-time="0"
  locators="127.0.0.1[7300]" ***(wanted "localhost[7300]")***
  lock-memory="false"
  log-disk-space-limit="50"
  log-file="/opt/ccio/geode/logs/geode.log"
  log-file-size-limit="10"
  log-level="config"
  max-num-reconnect-tries="3"
  max-wait-time-reconnect="60000"
  mcast-address="/239.192.81.1"
  mcast-flow-control="1048576, 0.25, 5000"
  mcast-port="0"
  mcast-recv-buffer-size="1048576"
  mcast-send-buffer-size="65535"
  mcast-ttl="32"
  member-timeout="5000"
  membership-port-range="[1024,65535]"
  memcached-bind-address=""
  memcached-port="0"
  memcached-protocol="ASCII"
  name=""
  off-heap-memory-size=""
  redis-bind-address=""
  redis-password=""
  redis-port="0"
  redundancy-zone=""
  remote-locators=""
  remove-unresponsive-client="false"
  roles=""
  security-=""
  security-client-accessor=""
  security-client-accessor-pp=""
  security-client-auth-init=""
  security-client-authenticator=""
  security-client-dhalgo=""
  security-log-file=""
  security-log-level="config"
  security-peer-auth-init=""
  security-peer-authenticator=""
  security-peer-verifymember-timeout="1000"
  server-bind-address=""
  server-ssl-ciphers="any"
  server-ssl-enabled="false"
  server-ssl-keystore=""
  server-ssl-keystore-password=""
  server-ssl-keystore-type=""
  server-ssl-protocols="any"
  server-ssl-require-authentication="true"
  server-ssl-truststore=""
  server-ssl-truststore-password=""
  socket-buffer-size="32768"
  socket-lease-time="60000"
  ssl-ciphers="any"
  ssl-enabled="false"
  ssl-protocols="any"
  ssl-require-authentication="true"
  start-dev-rest-api="false"
  start-locator=""
  statistic-archive-file=""
  statistic-sample-rate="1000"
  statistic-sampling-enabled="true"
  tcp-port="0"
  udp-fragment-size="60000"
  udp-recv-buffer-size="1048576"
  udp-send-buffer-size="65535"
  use-cluster-configuration="true"
  user-command-packages=""

    at com.gemstone.gemfire.distributed.internal.InternalDistributedSystem.validateSameProperties(InternalDistributedSystem.java:2890)
    at com.gemstone.gemfire.distributed.DistributedSystem.connect(DistributedSystem.java:1628)
    at com.gemstone.gemfire.cache.CacheFactory.create(CacheFactory.java:224)
    at com.gemstone.gemfire.distributed.ServerLauncher.startWithGemFireApi(ServerLauncher.java:822)
    at com.gemstone.gemfire.distributed.ServerLauncher.start(ServerLauncher.java:718)
    at ccio.image.Server.main(Server.java:18)

@HogonPivotal
Copy link

Hi, I have a question that which version of GemFire can work with your codes? I tried to remove the line 16 with GemFire 8.2 but got the following error:
Exception in thread "main" java.lang.NullPointerException
at com.gemstone.gemfire.internal.cache.BridgeServerImpl.start(BridgeServerImpl.java:301)
at com.gemstone.gemfire.distributed.ServerLauncher.startCacheServer(ServerLauncher.java:918)
at com.gemstone.gemfire.distributed.ServerLauncher.start(ServerLauncher.java:705)
at server.main(server.java:20)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment