Skip to content

Instantly share code, notes, and snippets.

@strokine
Created April 21, 2016 17:20
Show Gist options
  • 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();
}
}
@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